Re: [FFmpeg-devel] [PATCH][FFmpeg-devel v2] Add GPU accelerated video crop filter

2019-03-23 Thread Tao Zhang
Got it. Thanks Steven

Steven Liu  于2019年3月24日周日 上午9:00写道:

>
>
> > 在 2019年3月24日,07:26,Tao Zhang  写道:
> >
> > The corrected version. If there are no other comments or objections,
> could
> > this be pushed?
> Of course, maybe this need waiting for other reviewer, about 24 hours
> after maybe better than push it now.
> Because other reviewer maybe busy or not online weekend.
>
> >
> > UsingtcNower  于2019年3月23日周六 下午11:51写道:
> >
> >> Signed-off-by: UsingtcNower 
> >> ---
> >> Changelog   |   1 +
> >> configure   |   1 +
> >> doc/filters.texi|  31 +++
> >> libavfilter/Makefile|   1 +
> >> libavfilter/allfilters.c|   1 +
> >> libavfilter/version.h   |   2 +-
> >> libavfilter/vf_crop_cuda.c  | 638
> >> 
> >> libavfilter/vf_crop_cuda.cu | 109 
> >> 8 files changed, 783 insertions(+), 1 deletion(-)
> >> create mode 100644 libavfilter/vf_crop_cuda.c
> >> create mode 100644 libavfilter/vf_crop_cuda.cu
> >>
> >> diff --git a/Changelog b/Changelog
> >> index ad7e82f..f224fc8 100644
> >> --- a/Changelog
> >> +++ b/Changelog
> >> @@ -20,6 +20,7 @@ version :
> >> - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
> >> - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
> >> - removed libndi-newtek
> >> +- crop_cuda GPU accelerated video crop filter
> >>
> >>
> >> version 4.1:
> >> diff --git a/configure b/configure
> >> index 331393f..3f3ac2f 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -2973,6 +2973,7 @@ qsvvpp_select="qsv"
> >> vaapi_encode_deps="vaapi"
> >> v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
> >>
> >> +crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
> >> hwupload_cuda_filter_deps="ffnvcodec"
> >> scale_npp_filter_deps="ffnvcodec libnpp"
> >> scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
> >> diff --git a/doc/filters.texi b/doc/filters.texi
> >> index 4ffb392..ee16a2d 100644
> >> --- a/doc/filters.texi
> >> +++ b/doc/filters.texi
> >> @@ -7415,6 +7415,37 @@ If the specified expression is not valid, it is
> >> kept at its current
> >> value.
> >> @end table
> >>
> >> +@section crop_cuda
> >> +
> >> +Crop the input video to given dimensions, implemented in CUDA.
> >> +
> >> +It accepts the following parameters:
> >> +
> >> +@table @option
> >> +
> >> +@item w
> >> +The width of the output video. It defaults to @code{iw}.
> >> +This expression is evaluated only once during the filter
> >> +configuration.
> >> +
> >> +@item h
> >> +The height of the output video. It defaults to @code{ih}.
> >> +This expression is evaluated only once during the filter
> >> +configuration.
> >> +
> >> +@item x
> >> +The horizontal position, in the input video, of the left edge of the
> >> output
> >> +video. It defaults to @code{(in_w-out_w)/2}.
> >> +This expression is evaluated only once during the filter
> >> +configuration.
> >> +
> >> +@item y
> >> +The vertical position, in the input video, of the top edge of the
> output
> >> video.
> >> +It defaults to @code{(in_h-out_h)/2}.
> >> +This expression is evaluated only once during the filter
> >> +configuration.
> >> +@end table
> >> +
> >> @section cropdetect
> >>
> >> Auto-detect the crop size.
> >> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> >> index fef6ec5..84df037 100644
> >> --- a/libavfilter/Makefile
> >> +++ b/libavfilter/Makefile
> >> @@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   +=
> >> vf_copy.o
> >> OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
> >> OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o
> >> lavfutils.o
> >> OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
> >> +OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o
> >> vf_crop_cuda.ptx.o
> >> OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
> >> OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
> >> OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
> >> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> >> index c51ae0f..550e545 100644
> >> --- a/libavfilter/allfilters.c
> >> +++ b/libavfilter/allfilters.c
> >> @@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
> >> extern AVFilter ff_vf_coreimage;
> >> extern AVFilter ff_vf_cover_rect;
> >> extern AVFilter ff_vf_crop;
> >> +extern AVFilter ff_vf_crop_cuda;
> >> extern AVFilter ff_vf_cropdetect;
> >> extern AVFilter ff_vf_cue;
> >> extern AVFilter ff_vf_curves;
> >> diff --git a/libavfilter/version.h b/libavfilter/version.h
> >> index c71282c..5aa95f4 100644
> >> --- a/libavfilter/version.h
> >> +++ b/libavfilter/version.h
> >> @@ -31,7 +31,7 @@
> >>
> >> #define LIBAVFILTER_VERSION_MAJOR   7
> >> #define LIBAVFILTER_VERSION_MINOR  48
> >> -#define LIBAVFILTER_VERSION_MICRO 100
> >> +#define LIBAVFILTER_VERSION_MICRO 101
> >>
> >> #define LIBAVFILTER_VERSION_INT
> AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR,
> >> \
> >>
> LIBAVFILTER_VERSION_MINOR,
> >> \
> >> diff --git 

Re: [FFmpeg-devel] [PATCH] News: Removal of libndi

2019-03-23 Thread Ronald S. Bultje
Hi,

On Sat, Mar 23, 2019 at 11:03 AM Thilo Borgmann 
wrote:

> Am 21.03.19 um 11:55 schrieb Michael Niedermayer:
> > On Wed, Mar 20, 2019 at 05:41:31PM -0400, Ronald S. Bultje wrote:
> >> Hi,
> >>
> >> On Wed, Mar 20, 2019 at 4:15 PM Gyan  wrote:
> >>
> >>>
> >>>
> >>> On 21-03-2019 01:32 AM, Marton Balint wrote:
> 
> 
>  On Wed, 20 Mar 2019, Jean-Baptiste Kempf wrote:
> 
> > On Wed, 20 Mar 2019, at 20:52, Marton Balint wrote:
> >> On Wed, 20 Mar 2019, Jean-Baptiste Kempf wrote:
> >>
> >>> On Wed, 20 Mar 2019, at 19:34, Marton Balint wrote:
>  As I described in similar threads before, whether or not the
> >> project want >> closed source support for NDI is a subjective issue,
> >> please start a vote >> about the removal of libndi if you want to
> >> seek this through.
> >>>
> >>> The removal of libndi is actually done and committed.
> >>
> >> That is just sad an unfair.
> >
> > Sad, maybe.
> > Unfair, I disagree. If NDI wants to be in, they know what to do.
> 
>  It is unfair towards the people who expressied disapproval, yet this
>  change was committed without neither vote nor consensus.
> >>>
> >>> +1. This was a political decision, not a technical one. A formal(-ish)
> >>> survey should have happened on the ML.
> >>>
> >>
> >> I agree we need a formal vote on this. I would like to set a wider
> project
> >> policy w.r.t. closed-source software integration, this is just one
> instance
> >> of a more general issue.
>
> > I think there should have been a vote before pushing a commit as there
> where
> > FFmpeg developers objecting to it.
> > Ignoring people causes nothing good. Had there been a vote people would
> be
> > alot less upset about it as everyones oppinion would be counted equally
> >
> > It makes me unhappy that one FFmpeg developer apparently decided to leave
> > the project already because of this.
> > I think we should fix this, make a proper policy, with a proper vote
> > and then hopefully noone feels the need to leave.
>
> +1
>
> >>
> >> Who wants to organize it?
> >
> > Thilo organized the last vote, maybe he wants to do it ?
> > but if noone else wants to do it i can do one too if people want and
> > there is consensus who can vote
> > If i search for "open source vote free" on google it points to
> > vote.heliosvoting.org as first hit
> > this seems rather basic but for simple yes/no questions it could work
> > maybe someone has a better suggestion we could use for more complex
> future
> > cases that is multiple choice votes in teh future (schulze STV / CPO-STV
> > for multiwinner or ScottishSTV (used by SPI), schulze method (used by
> debian)
> > for one winner of N choices would be nice to have)
>
> Including for simple yes/no votes we can use the same LimeSurvey host we
> got provided from KDE for the survey. Also for anonymous votes.


I think what we have to figure out is whether we want to ask:

- do we want to keep (or remove) NDI?

or

- do we want to keep any components requiring linking with non-system,
closed-source software? (this might or might not include blackmagic)

or some other variant that also includes system software like nvidia stuff?
Or ask a simple yes/no for each component separately? (Although that
wouldn't set a more general policy.)

Ronald
___
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][FFmpeg-devel v2] Add GPU accelerated video crop filter

2019-03-23 Thread Steven Liu


> 在 2019年3月24日,07:26,Tao Zhang  写道:
> 
> The corrected version. If there are no other comments or objections, could
> this be pushed?
Of course, maybe this need waiting for other reviewer, about 24 hours after 
maybe better than push it now.
Because other reviewer maybe busy or not online weekend.

> 
> UsingtcNower  于2019年3月23日周六 下午11:51写道:
> 
>> Signed-off-by: UsingtcNower 
>> ---
>> Changelog   |   1 +
>> configure   |   1 +
>> doc/filters.texi|  31 +++
>> libavfilter/Makefile|   1 +
>> libavfilter/allfilters.c|   1 +
>> libavfilter/version.h   |   2 +-
>> libavfilter/vf_crop_cuda.c  | 638
>> 
>> libavfilter/vf_crop_cuda.cu | 109 
>> 8 files changed, 783 insertions(+), 1 deletion(-)
>> create mode 100644 libavfilter/vf_crop_cuda.c
>> create mode 100644 libavfilter/vf_crop_cuda.cu
>> 
>> diff --git a/Changelog b/Changelog
>> index ad7e82f..f224fc8 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -20,6 +20,7 @@ version :
>> - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
>> - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
>> - removed libndi-newtek
>> +- crop_cuda GPU accelerated video crop filter
>> 
>> 
>> version 4.1:
>> diff --git a/configure b/configure
>> index 331393f..3f3ac2f 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2973,6 +2973,7 @@ qsvvpp_select="qsv"
>> vaapi_encode_deps="vaapi"
>> v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
>> 
>> +crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
>> hwupload_cuda_filter_deps="ffnvcodec"
>> scale_npp_filter_deps="ffnvcodec libnpp"
>> scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index 4ffb392..ee16a2d 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -7415,6 +7415,37 @@ If the specified expression is not valid, it is
>> kept at its current
>> value.
>> @end table
>> 
>> +@section crop_cuda
>> +
>> +Crop the input video to given dimensions, implemented in CUDA.
>> +
>> +It accepts the following parameters:
>> +
>> +@table @option
>> +
>> +@item w
>> +The width of the output video. It defaults to @code{iw}.
>> +This expression is evaluated only once during the filter
>> +configuration.
>> +
>> +@item h
>> +The height of the output video. It defaults to @code{ih}.
>> +This expression is evaluated only once during the filter
>> +configuration.
>> +
>> +@item x
>> +The horizontal position, in the input video, of the left edge of the
>> output
>> +video. It defaults to @code{(in_w-out_w)/2}.
>> +This expression is evaluated only once during the filter
>> +configuration.
>> +
>> +@item y
>> +The vertical position, in the input video, of the top edge of the output
>> video.
>> +It defaults to @code{(in_h-out_h)/2}.
>> +This expression is evaluated only once during the filter
>> +configuration.
>> +@end table
>> +
>> @section cropdetect
>> 
>> Auto-detect the crop size.
>> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> index fef6ec5..84df037 100644
>> --- a/libavfilter/Makefile
>> +++ b/libavfilter/Makefile
>> @@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   +=
>> vf_copy.o
>> OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
>> OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o
>> lavfutils.o
>> OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
>> +OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o
>> vf_crop_cuda.ptx.o
>> OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
>> OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
>> OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> index c51ae0f..550e545 100644
>> --- a/libavfilter/allfilters.c
>> +++ b/libavfilter/allfilters.c
>> @@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
>> extern AVFilter ff_vf_coreimage;
>> extern AVFilter ff_vf_cover_rect;
>> extern AVFilter ff_vf_crop;
>> +extern AVFilter ff_vf_crop_cuda;
>> extern AVFilter ff_vf_cropdetect;
>> extern AVFilter ff_vf_cue;
>> extern AVFilter ff_vf_curves;
>> diff --git a/libavfilter/version.h b/libavfilter/version.h
>> index c71282c..5aa95f4 100644
>> --- a/libavfilter/version.h
>> +++ b/libavfilter/version.h
>> @@ -31,7 +31,7 @@
>> 
>> #define LIBAVFILTER_VERSION_MAJOR   7
>> #define LIBAVFILTER_VERSION_MINOR  48
>> -#define LIBAVFILTER_VERSION_MICRO 100
>> +#define LIBAVFILTER_VERSION_MICRO 101
>> 
>> #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR,
>> \
>>LIBAVFILTER_VERSION_MINOR,
>> \
>> diff --git a/libavfilter/vf_crop_cuda.c b/libavfilter/vf_crop_cuda.c
>> new file mode 100644
>> index 000..fc6a2a6
>> --- /dev/null
>> +++ b/libavfilter/vf_crop_cuda.c
>> @@ -0,0 +1,638 @@
>> +/*
>> +* Copyright (c) 2019, iQIYI CORPORATION. All rights reserved.
>> +*
>> +* Permission is hereby granted, 

Re: [FFmpeg-devel] [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Carl Eugen Hoyos
2019-03-24 0:26 GMT+01:00, Lynne :
>
> 23 Mar 2019, 22:27 by ceffm...@gmail.com:
>
>> 2019-03-23 19:20 GMT+01:00, Lynne <> d...@lynne.ee >
>> >:
>>
>> Which toolchains did you test?
>> (For compilation, not performance.)
>
> gcc 8.2.1 on both aarch64 and x86-64

 Please also test Android and tell us if you
 can test ios compilation.
 (Assuming you cannot test arm64 for Windows.)
>>>
>>> I can't install aarch64 android on the raspberry pi 3
>>> so I can't test that.
>>
>> Please test compilation for Android (there is no native
>> toolchain afaik).
>
> Cross compilation works fine.

Which toolchain did you test?

Carl Eugen

make libavcodec/aarch64/opusdsp_neon.o
AS  libavcodec/aarch64/opusdsp_neon.o
/tmp/opusdsp_neon-ac304f.s:86:33: error: invalid operand for instruction
fmul v0.4s, v4.4s, v0.4s[0]
^
/tmp/opusdsp_neon-ac304f.s:90:33: error: invalid operand for instruction
fmla v0.4s, v5.4s, v1.4s[0]
^
/tmp/opusdsp_neon-ac304f.s:91:33: error: invalid operand for instruction
fmul v3.4s, v7.4s, v2.4s[2]
^
/tmp/opusdsp_neon-ac304f.s:93:33: error: invalid operand for instruction
fmla v0.4s, v6.4s, v1.4s[1]
^
/tmp/opusdsp_neon-ac304f.s:94:33: error: invalid operand for instruction
fmla v3.4s, v6.4s, v2.4s[1]
^
/tmp/opusdsp_neon-ac304f.s:96:33: error: invalid operand for instruction
fmla v0.4s, v7.4s, v1.4s[2]
^
/tmp/opusdsp_neon-ac304f.s:97:33: error: invalid operand for instruction
fmla v3.4s, v5.4s, v2.4s[0]
^
/tmp/opusdsp_neon-ac304f.s:102:33: error: invalid operand for instruction
fmla v2.4s, v4.4s, v1.4s[3]
^
/tmp/opusdsp_neon-ac304f.s:105:33: error: invalid operand for instruction
fmul v0.4s, v4.4s, v2.4s[3]
^
/tmp/opusdsp_neon-ac304f.s:110:17: error: invalid operand for instruction
mov s0, v2.4s[3]
^
/tmp/opusdsp_neon-ac304f.s:117:20: error: invalid operand for instruction
dup v1.4s, v0.4s[1]
   ^
/tmp/opusdsp_neon-ac304f.s:118:20: error: invalid operand for instruction
dup v2.4s, v0.4s[2]
   ^
/tmp/opusdsp_neon-ac304f.s:119:20: error: invalid operand for instruction
dup v0.4s, v0.4s[0]
   ^
make: *** [libavcodec/aarch64/opusdsp_neon.o] Error 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] beautified + accelerated vf_fillborders – Please review

2019-03-23 Thread Carl Eugen Hoyos
2019-03-24 0:13 GMT+01:00, Ulf Zibis :
> Hi again,
>
> Am 19.03.19 um 17:31 schrieb Carl Eugen Hoyos:
>> One run is not good.
>> Either use the loop option to filter the same frame again and
>> again or feed a video to ffmpeg.
>
> I have new patches.
>
> Patch 1 is just a little renaming and a preparation for the
> benchmark timer code.

There are two patches "1", one with wrong indentation.

Iiuc, the patch mixes the following:
Renaming of a variable
Moving of blocks
Adding commented code that is removed in a later patch
Replacing constants with harder to read calculations
Adding comments

I don't maintain the file but in general not all of these are
acceptable and it any case should be separate changes.

> Patch 2 is a slight enhancement in performance for cases,
> where only top and bottom borders are filled.

This also removes outcommented code which should
not be part of a performance enhancement.
How much "slight enhancement" were you able to measure?
Iiuc, some cases get slower, no?
Some people prefer that patches like this do not change the
indentation to make it more readable.

> Patch 3 beautifies the code an really enhances the performance.

Again: Please do not mix functional and cosmetic changes.

> See the results included in the benchmark patch

Do I read the results correctly that for all patches some cases
get faster and others get slower?

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][FFmpeg-devel v2] Add GPU accelerated video crop filter

2019-03-23 Thread Tao Zhang
The corrected version. If there are no other comments or objections, could
this be pushed?

UsingtcNower  于2019年3月23日周六 下午11:51写道:

> Signed-off-by: UsingtcNower 
> ---
>  Changelog   |   1 +
>  configure   |   1 +
>  doc/filters.texi|  31 +++
>  libavfilter/Makefile|   1 +
>  libavfilter/allfilters.c|   1 +
>  libavfilter/version.h   |   2 +-
>  libavfilter/vf_crop_cuda.c  | 638
> 
>  libavfilter/vf_crop_cuda.cu | 109 
>  8 files changed, 783 insertions(+), 1 deletion(-)
>  create mode 100644 libavfilter/vf_crop_cuda.c
>  create mode 100644 libavfilter/vf_crop_cuda.cu
>
> diff --git a/Changelog b/Changelog
> index ad7e82f..f224fc8 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -20,6 +20,7 @@ version :
>  - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
>  - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
>  - removed libndi-newtek
> +- crop_cuda GPU accelerated video crop filter
>
>
>  version 4.1:
> diff --git a/configure b/configure
> index 331393f..3f3ac2f 100755
> --- a/configure
> +++ b/configure
> @@ -2973,6 +2973,7 @@ qsvvpp_select="qsv"
>  vaapi_encode_deps="vaapi"
>  v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
>
> +crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
>  hwupload_cuda_filter_deps="ffnvcodec"
>  scale_npp_filter_deps="ffnvcodec libnpp"
>  scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 4ffb392..ee16a2d 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -7415,6 +7415,37 @@ If the specified expression is not valid, it is
> kept at its current
>  value.
>  @end table
>
> +@section crop_cuda
> +
> +Crop the input video to given dimensions, implemented in CUDA.
> +
> +It accepts the following parameters:
> +
> +@table @option
> +
> +@item w
> +The width of the output video. It defaults to @code{iw}.
> +This expression is evaluated only once during the filter
> +configuration.
> +
> +@item h
> +The height of the output video. It defaults to @code{ih}.
> +This expression is evaluated only once during the filter
> +configuration.
> +
> +@item x
> +The horizontal position, in the input video, of the left edge of the
> output
> +video. It defaults to @code{(in_w-out_w)/2}.
> +This expression is evaluated only once during the filter
> +configuration.
> +
> +@item y
> +The vertical position, in the input video, of the top edge of the output
> video.
> +It defaults to @code{(in_h-out_h)/2}.
> +This expression is evaluated only once during the filter
> +configuration.
> +@end table
> +
>  @section cropdetect
>
>  Auto-detect the crop size.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index fef6ec5..84df037 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   +=
> vf_copy.o
>  OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
>  OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o
> lavfutils.o
>  OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
> +OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o
> vf_crop_cuda.ptx.o
>  OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
>  OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
>  OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index c51ae0f..550e545 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
>  extern AVFilter ff_vf_coreimage;
>  extern AVFilter ff_vf_cover_rect;
>  extern AVFilter ff_vf_crop;
> +extern AVFilter ff_vf_crop_cuda;
>  extern AVFilter ff_vf_cropdetect;
>  extern AVFilter ff_vf_cue;
>  extern AVFilter ff_vf_curves;
> diff --git a/libavfilter/version.h b/libavfilter/version.h
> index c71282c..5aa95f4 100644
> --- a/libavfilter/version.h
> +++ b/libavfilter/version.h
> @@ -31,7 +31,7 @@
>
>  #define LIBAVFILTER_VERSION_MAJOR   7
>  #define LIBAVFILTER_VERSION_MINOR  48
> -#define LIBAVFILTER_VERSION_MICRO 100
> +#define LIBAVFILTER_VERSION_MICRO 101
>
>  #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR,
> \
> LIBAVFILTER_VERSION_MINOR,
> \
> diff --git a/libavfilter/vf_crop_cuda.c b/libavfilter/vf_crop_cuda.c
> new file mode 100644
> index 000..fc6a2a6
> --- /dev/null
> +++ b/libavfilter/vf_crop_cuda.c
> @@ -0,0 +1,638 @@
> +/*
> +* Copyright (c) 2019, iQIYI CORPORATION. All rights reserved.
> +*
> +* Permission is hereby granted, free of charge, to any person obtaining a
> +* copy of this software and associated documentation files (the
> "Software"),
> +* to deal in the Software without restriction, including without
> limitation
> +* the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +* and/or sell copies of the Software, 

Re: [FFmpeg-devel] [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Lynne



23 Mar 2019, 22:27 by ceffm...@gmail.com:

> 2019-03-23 19:20 GMT+01:00, Lynne <> d...@lynne.ee > >:
>
> Which toolchains did you test?
> (For compilation, not performance.)
>

 gcc 8.2.1 on both aarch64 and x86-64

>>>
>>> Please also test Android and tell us if you
>>> can test ios compilation.
>>> (Assuming you cannot test arm64 for Windows.)
>>>
>>
>> I can't install aarch64 android on the raspberry pi 3
>> so I can't test that.
>>
>
> Please test compilation for Android (there is no native
> toolchain afaik).
>

Cross compilation works fine.
___
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] beautified + accelerated vf_fillborders – Please review

2019-03-23 Thread Ulf Zibis
Hi again,

Am 19.03.19 um 17:31 schrieb Carl Eugen Hoyos:
> One run is not good.
> Either use the loop option to filter the same frame again and
> again or feed a video to ffmpeg.

I have new patches.

Patch 1 is just a little renaming and a preparation for the benchmark
timer code.

Patch 2 is a slight enhancement in performance for cases, where only top
and bottom borders are filled.

Patch 3 beautifies the code an really enhances the performance. See the
results included in the benchmark patch

-Ulf

>From d78d496c0ed7ba83bf113d3f9cf5d68ce62ce4eb Mon Sep 17 00:00:00 2001
From: Ulf Zibis 
Date: 14.03.2019, 19:34:03

avfilter/fillborders: added comments; named more descriptive; corrected indentations;
moved fillborders_options[] more up, needed for STOP_TIMER(testcase);

diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c
index 1344587..ce768d4 100644
--- a/libavfilter/vf_fillborders.c
+++ b/libavfilter/vf_fillborders.c
@@ -19,14 +19,16 @@
  */
 
 #include "libavutil/colorspace.h"
-#include "libavutil/common.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
-#include "avfilter.h"
 #include "drawutils.h"
-#include "formats.h"
 #include "internal.h"
+/*
+#include "libavutil/common.h"
+#include "avfilter.h"
+#include "formats.h"
 #include "video.h"
+*/
 
 enum { Y, U, V, A };
 enum { R, G, B };
@@ -53,6 +55,22 @@
 
 void (*fillborders)(struct FillBordersContext *s, AVFrame *frame);
 } FillBordersContext;
+
+#define OFFSET(x) offsetof(FillBordersContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+
+static const AVOption fillborders_options[] = {
+{ "left",   "set the left fill border",   OFFSET(left),   AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX,FLAGS },
+{ "right",  "set the right fill border",  OFFSET(right),  AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX,FLAGS },
+{ "top","set the top fill border",OFFSET(top),AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX,FLAGS },
+{ "bottom", "set the bottom fill border", OFFSET(bottom), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX,FLAGS },
+{ "mode",   "set the fill borders mode",  OFFSET(mode),   AV_OPT_TYPE_INT, {.i64=FM_SMEAR}, 0, FM_NB_MODES-1, FLAGS, "mode" },
+{ "smear",  NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_SMEAR},  0, 0, FLAGS, "mode" },
+{ "mirror", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_MIRROR}, 0, 0, FLAGS, "mode" },
+{ "fixed",  NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_FIXED},  0, 0, FLAGS, "mode" },
+{ "color",  "set the color for the fixed mode", OFFSET(rgba_color), AV_OPT_TYPE_COLOR, {.str = "black"}, .flags = FLAGS },
+{ NULL }
+};
 
 static int query_formats(AVFilterContext *ctx)
 {
@@ -87,27 +105,28 @@
 int p, y;
 
 for (p = 0; p < s->nb_planes; p++) {
-uint8_t *ptr = frame->data[p];
+uint8_t *data = frame->data[p];
 int linesize = frame->linesize[p];
 
+/* fill left and right borders from top to bottom border */
 for (y = s->borders[p].top; y < s->planeheight[p] - s->borders[p].bottom; y++) {
-memset(ptr + y * linesize,
-   *(ptr + y * linesize + s->borders[p].left),
-   s->borders[p].left);
-memset(ptr + y * linesize + s->planewidth[p] - s->borders[p].right,
-   *(ptr + y * linesize + s->planewidth[p] - s->borders[p].right - 1),
-   s->borders[p].right);
+memset(data + y * linesize,
+*(data + y * linesize + s->borders[p].left),
+s->borders[p].left);
+memset(data + y * linesize + s->planewidth[p] - s->borders[p].right,
+*(data + y * linesize + s->planewidth[p] - s->borders[p].right - 1),
+s->borders[p].right);
 }
 
+/* fill top and bottom borders */
 for (y = 0; y < s->borders[p].top; y++) {
-memcpy(ptr + y * linesize,
-   ptr + s->borders[p].top * linesize, s->planewidth[p]);
+memcpy(data + y * linesize,
+data + s->borders[p].top * linesize, s->planewidth[p]);
 }
-
 for (y = s->planeheight[p] - s->borders[p].bottom; y < s->planeheight[p]; y++) {
-memcpy(ptr + y * linesize,
-   ptr + (s->planeheight[p] - s->borders[p].bottom - 1) * linesize,
-   s->planewidth[p]);
+memcpy(data + y * linesize,
+data + (s->planeheight[p] - s->borders[p].bottom - 1) * linesize,
+s->planewidth[p]);
 }
 }
 }
@@ -117,29 +136,29 @@
 int p, y, x;
 
 for (p = 0; p < s->nb_planes; p++) {
-uint16_t *ptr = (uint16_t *)frame->data[p];
-int linesize = frame->linesize[p] / 2;
+uint16_t *data = (uint16_t *)frame->data[p];
+int linesize = frame->linesize[p] / sizeof(uint16_t);
 
+/* fill left and right borders from top to bottom border */
 for (y = s->borders[p].top; y < 

Re: [FFmpeg-devel] [PATCH] avcodec/tiff: do not allow bpp 40 with undefined pixel formats

2019-03-23 Thread Carl Eugen Hoyos
2019-03-23 19:16 GMT+01:00, Michael Niedermayer :
> Fixes: Out of array access, assertion failure
> Fixes:
> 13851/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5754570929602560
> Fixes:
> 13869/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5695998313103360
> Fixes:
> 13873/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5077273645940736
> Fixes:
> 13874/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5756396757319680
> Fixes:
> 13877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5741026750234624
> Fixes:
> 13880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5649148809838592
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/tiff.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 29a80a6892..3130eb8048 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -830,6 +830,11 @@ static int init_image(TiffContext *s, ThreadFrame
> *frame)
>  case 405:
>  if (s->photometric == TIFF_PHOTOMETRIC_SEPARATED)
>  s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
> +else {
> +av_log(s->avctx, AV_LOG_ERROR,
> +"bpp=40 without PHOTOMETRIC_SEPARATED is unsupported\n");
> +return AVERROR_PATCHWELCOME;

Lgtm, thank you!

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 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Carl Eugen Hoyos
2019-03-23 19:20 GMT+01:00, Lynne :

 Which toolchains did you test?
 (For compilation, not performance.)
>>>
>>> gcc 8.2.1 on both aarch64 and x86-64
>>
>> Please also test Android and tell us if you
>> can test ios compilation.
>> (Assuming you cannot test arm64 for Windows.)
>
> I can't install aarch64 android on the raspberry pi 3
> so I can't test that.

Please test compilation for Android (there is no native
toolchain afaik).

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] avcodec/hevcdec: Avoid only partly skiping duplicate first slices

2019-03-23 Thread James Almer
On 3/23/2019 5:25 PM, Michael Niedermayer wrote:
> Fixes: NULL pointer dereference and out of array access
> Fixes: 
> 13871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5746167087890432
> Fixes: 
> 13845/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5650370728034304
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hevcdec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index 86adab0ae1..4d149f4d9f 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -488,6 +488,9 @@ static int hls_slice_header(HEVCContext *s)
>  
>  // Coded parameters
>  sh->first_slice_in_pic_flag = get_bits1(gb);
> +if (s->ref && sh->first_slice_in_pic_flag)
> +return 0; // This slice will be skiped later, do not corrupt state

I assume this is a regression after 70c8c8a818? If so, please also
backport this patch to branches 2.8 to 4.1.

> +
>  if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) {
>  s->seq_decode = (s->seq_decode + 1) & 0xff;
>  s->max_ra = INT_MAX;
> 

___
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/hevcdec: Avoid only partly skiping duplicate first slices

2019-03-23 Thread Michael Niedermayer
Fixes: NULL pointer dereference and out of array access
Fixes: 
13871/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5746167087890432
Fixes: 
13845/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5650370728034304

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

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 86adab0ae1..4d149f4d9f 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -488,6 +488,9 @@ static int hls_slice_header(HEVCContext *s)
 
 // Coded parameters
 sh->first_slice_in_pic_flag = get_bits1(gb);
+if (s->ref && sh->first_slice_in_pic_flag)
+return 0; // This slice will be skiped later, do not corrupt state
+
 if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) {
 s->seq_decode = (s->seq_decode + 1) & 0xff;
 s->max_ra = INT_MAX;
-- 
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 v2] avfilter/src_movie: change the deprecate API to new decode api

2019-03-23 Thread Nicolas George
Steven Liu (12019-03-23):
> Signed-off-by: Steven Liu 
> ---
>  libavfilter/src_movie.c | 25 ++---
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
> index bcabfcc4c2..65561a3959 100644
> --- a/libavfilter/src_movie.c
> +++ b/libavfilter/src_movie.c
> @@ -172,8 +172,6 @@ static int open_stream(void *log, MovieStream *st)
>  if (ret < 0)
>  return ret;
>  
> -st->codec_ctx->refcounted_frames = 1;
> -
>  if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
>  av_log(log, AV_LOG_ERROR, "Failed to open codec\n");
>  return ret;
> @@ -524,17 +522,22 @@ static int movie_push_frame(AVFilterContext *ctx, 
> unsigned out_id)
>  return AVERROR(ENOMEM);
>  
>  frame_type = st->st->codecpar->codec_type;
> -switch (frame_type) {
> -case AVMEDIA_TYPE_VIDEO:
> -ret = avcodec_decode_video2(st->codec_ctx, frame, _frame, pkt);
> -break;
> -case AVMEDIA_TYPE_AUDIO:
> -ret = avcodec_decode_audio4(st->codec_ctx, frame, _frame, pkt);
> -break;
> -default:
> +if (frame_type == AVMEDIA_TYPE_VIDEO || frame_type == 
> AVMEDIA_TYPE_AUDIO) {

> +ret = avcodec_send_packet(st->codec_ctx, pkt);
> +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
> +ret = 0;
> +}
> +if (ret >= 0) {
> +ret = avcodec_receive_frame(st->codec_ctx, frame);

This is doing one avcodec_receive_frame() for each
avcodec_send_packet(): this is not how the new API is supposed to be
used. If it was, there would not have been the need for a new API in the
first place, would it?

> +if (ret >= 0)
> +got_frame = 1;
> +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
> +ret = 0;
> +}
> +} else {
>  ret = AVERROR(ENOSYS);
> -break;
>  }
> +
>  if (ret < 0) {
>  av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret));
>  av_frame_free();

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 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Lynne



23 Mar 2019, 16:20 by ceffm...@gmail.com:

> 2019-03-23 17:16 GMT+01:00, Lynne <> d...@lynne.ee > >:
>
>> 23 Mar 2019, 15:04 by >> ceffm...@gmail.com >> :
>>
>>> 2019-03-23 15:23 GMT+01:00, Lynne <> >>> d...@lynne.ee 
>>> > d...@lynne.ee 
>>> >
>>> >:
>>>
 16 Mar 2019, 16:34 by >>  d...@lynne.ee   
 >>> d...@lynne.ee  >>> :

> 153372 UNITS in postfilter_c,   65536 runs,  0 skips
> 73164 UNITS in postfilter_neon,   65536 runs,  0 skips -> 2.1x
> speedup
>
> 80591 UNITS in deemphasis_c,  131072 runs,  0 skips
> 43969 UNITS in deemphasis_neon,  131072 runs,  0 skips -> 1.83x
> speedup
>
> Total decoder speedup: ~15% on a Raspberry Pi 3 (from 28.1x to 33.5x
> realtime)
>
> Deemphasis SIMD based on the following unrolling:
> const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
> float state = coeff;
>
> for (int i = 0; i < len; i += 4) {
>  y[0] = x[0] + c1*state;
>  y[1] = x[1] + c2*state + c1*x[0];
>  y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
>  y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];
>
>  state = y[3];
>  y += 4;
>  x += 4;
> }
>
> Unlike the x86 version, duplication is used instead of pslldq so
> the structure and tables are different.
> Same approach tested on x86 (3x pslldq -> vbroadcastss + shufps +
> pslldq)
> had the same performance, so 3x pslldq was kept as vbroadcastss has a
> higher latency.
>

 Could someone review the patches?

>>>
>>> Which toolchains did you test?
>>> (For compilation, not performance.)
>>>
>>
>> gcc 8.2.1 on both aarch64 and x86-64
>>
>
> Please also test Android and tell us if you
> can test ios compilation.
> (Assuming you cannot test arm64 for Windows.)
>

I can't install aarch64 android on the raspberry pi 3 so I can't test that. I 
don't know if cross-compilation is even possible for aarch64 windows.
I don't have an ios device.
___
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/tiff: do not allow bpp 40 with undefined pixel formats

2019-03-23 Thread Michael Niedermayer
Fixes: Out of array access, assertion failure
Fixes: 
13851/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5754570929602560
Fixes: 
13869/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5695998313103360
Fixes: 
13873/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5077273645940736
Fixes: 
13874/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5756396757319680
Fixes: 
13877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5741026750234624
Fixes: 
13880/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5649148809838592

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

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 29a80a6892..3130eb8048 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -830,6 +830,11 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
 case 405:
 if (s->photometric == TIFF_PHOTOMETRIC_SEPARATED)
 s->avctx->pix_fmt = AV_PIX_FMT_RGBA;
+else {
+av_log(s->avctx, AV_LOG_ERROR,
+"bpp=40 without PHOTOMETRIC_SEPARATED is unsupported\n");
+return AVERROR_PATCHWELCOME;
+}
 break;
 case 483:
 s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGB48LE  : AV_PIX_FMT_RGB48BE;
-- 
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] avcodec/cbs_av1: fix range of values for Mastering Display Color Volume Metadata OBUs

2019-03-23 Thread James Almer
Signed-off-by: James Almer 
---
> Does something like
> FFMIN(((uint64_t)current->luminance_max << 6) - 1, MAX_UINT_BITS(32))
> do the right thing?

Yes. Fixed and a comment added.

 libavcodec/cbs_av1_syntax_template.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cbs_av1_syntax_template.c 
b/libavcodec/cbs_av1_syntax_template.c
index 48f4fab514..76eb90b279 100644
--- a/libavcodec/cbs_av1_syntax_template.c
+++ b/libavcodec/cbs_av1_syntax_template.c
@@ -1637,15 +1637,18 @@ static int 
FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
 int err, i;
 
 for (i = 0; i < 3; i++) {
-fcs(16, primary_chromaticity_x[i], 0, 5, 1, i);
-fcs(16, primary_chromaticity_y[i], 0, 5, 1, i);
+fbs(16, primary_chromaticity_x[i], 1, i);
+fbs(16, primary_chromaticity_y[i], 1, i);
 }
 
-fc(16, white_point_chromaticity_x, 0, 5);
-fc(16, white_point_chromaticity_y, 0, 5);
+fb(16, white_point_chromaticity_x);
+fb(16, white_point_chromaticity_y);
 
 fc(32, luminance_max, 1, MAX_UINT_BITS(32));
-fc(32, luminance_min, 0, current->luminance_max >> 6);
+// luminance_min must be lower than luminance_max. Convert luminance_max 
from
+// 24.8 fixed point to 18.14 fixed point in order to compare them.
+fc(32, luminance_min, 0, FFMIN(((uint64_t)current->luminance_max << 6) - 1,
+   MAX_UINT_BITS(32)));
 
 return 0;
 }
-- 
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 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Carl Eugen Hoyos
2019-03-23 17:16 GMT+01:00, Lynne :
> 23 Mar 2019, 15:04 by ceffm...@gmail.com:
>
>> 2019-03-23 15:23 GMT+01:00, Lynne <> d...@lynne.ee >
>> >:
>>
>>> 16 Mar 2019, 16:34 by >> d...@lynne.ee >> :
>>>
 153372 UNITS in postfilter_c,   65536 runs,  0 skips
 73164 UNITS in postfilter_neon,   65536 runs,  0 skips -> 2.1x
 speedup

 80591 UNITS in deemphasis_c,  131072 runs,  0 skips
 43969 UNITS in deemphasis_neon,  131072 runs,  0 skips -> 1.83x
 speedup

 Total decoder speedup: ~15% on a Raspberry Pi 3 (from 28.1x to 33.5x
 realtime)

 Deemphasis SIMD based on the following unrolling:
 const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
 float state = coeff;

 for (int i = 0; i < len; i += 4) {
  y[0] = x[0] + c1*state;
  y[1] = x[1] + c2*state + c1*x[0];
  y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
  y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];

  state = y[3];
  y += 4;
  x += 4;
 }

 Unlike the x86 version, duplication is used instead of pslldq so
 the structure and tables are different.
 Same approach tested on x86 (3x pslldq -> vbroadcastss + shufps +
 pslldq)
 had the same performance, so 3x pslldq was kept as vbroadcastss has a
 higher latency.

>>>
>>> Could someone review the patches?
>>>
>>
>> Which toolchains did you test?
>> (For compilation, not performance.)
>>
>
> gcc 8.2.1 on both aarch64 and x86-64

Please also test Android and tell us if you
can test ios compilation.
(Assuming you cannot test arm64 for Windows.)

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

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

[FFmpeg-devel] [PATCH v3 1/2] vf_crop: Add support for cropping hardware frames

2019-03-23 Thread Mark Thompson
Set the cropping fields in the AVFrame.
---
 libavfilter/vf_crop.c | 74 +--
 1 file changed, 51 insertions(+), 23 deletions(-)

There is the slightly unfortunate effect the filter links don't carry the 
cropping information, so we don't know how big the cropped output is in 
following links until we actually get a frame.

For example, to get the middle ninth of a stream:

./ffmpeg_g -y -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 
-hwaccel_output_format vaapi -i in.mp4 -an -vf 
"crop=iw/3:ih/3:iw/3:ih/3,scale_vaapi=iw/3:ih/3" -c:v h264_vaapi out.mp4

Without the extra arguments to scale it will take the cropped part correctly 
but then scale it to the original size.

diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 84be4c7d0d..7f6b0f03d3 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -98,9 +98,17 @@ static int query_formats(AVFilterContext *ctx)
 
 for (fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
-if (!(desc->flags & (AV_PIX_FMT_FLAG_HWACCEL | 
AV_PIX_FMT_FLAG_BITSTREAM)) &&
-!((desc->log2_chroma_w || desc->log2_chroma_h) && !(desc->flags & 
AV_PIX_FMT_FLAG_PLANAR)) &&
-(ret = ff_add_format(, fmt)) < 0)
+if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
+continue;
+if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
+// Not usable if there is any subsampling but the format is
+// not planar (e.g. YUYV422).
+if ((desc->log2_chroma_w || desc->log2_chroma_h) &&
+!(desc->flags & AV_PIX_FMT_FLAG_PLANAR))
+continue;
+}
+ret = ff_add_format(, fmt);
+if (ret < 0)
 return ret;
 }
 
@@ -157,8 +165,14 @@ static int config_input(AVFilterLink *link)
 s->var_values[VAR_POS]   = NAN;
 
 av_image_fill_max_pixsteps(s->max_step, NULL, pix_desc);
-s->hsub = pix_desc->log2_chroma_w;
-s->vsub = pix_desc->log2_chroma_h;
+
+if (pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
+s->hsub = 1;
+s->vsub = 1;
+} else {
+s->hsub = pix_desc->log2_chroma_w;
+s->vsub = pix_desc->log2_chroma_h;
+}
 
 if ((ret = av_expr_parse_and_eval(, (expr = s->w_expr),
   var_names, s->var_values,
@@ -237,9 +251,15 @@ fail_expr:
 static int config_output(AVFilterLink *link)
 {
 CropContext *s = link->src->priv;
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
 
-link->w = s->w;
-link->h = s->h;
+if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
+// Hardware frames adjust the cropping regions rather than
+// changing the frame size.
+} else {
+link->w = s->w;
+link->h = s->h;
+}
 link->sample_aspect_ratio = s->out_sar;
 
 return 0;
@@ -252,9 +272,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
 int i;
 
-frame->width  = s->w;
-frame->height = s->h;
-
 s->var_values[VAR_N] = link->frame_count_out;
 s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
 NAN : frame->pts * av_q2d(link->time_base);
@@ -285,22 +302,33 @@ static int filter_frame(AVFilterLink *link, AVFrame 
*frame)
 (int)s->var_values[VAR_N], s->var_values[VAR_T], 
s->var_values[VAR_POS],
 s->x, s->y, s->x+s->w, s->y+s->h);
 
-frame->data[0] += s->y * frame->linesize[0];
-frame->data[0] += s->x * s->max_step[0];
-
-if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & FF_PSEUDOPAL)) {
-for (i = 1; i < 3; i ++) {
-if (frame->data[i]) {
-frame->data[i] += (s->y >> s->vsub) * frame->linesize[i];
-frame->data[i] += (s->x * s->max_step[i]) >> s->hsub;
+if (desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
+frame->crop_top   += s->y;
+frame->crop_left  += s->x;
+frame->crop_bottom = frame->height - frame->crop_top - 
frame->crop_bottom - s->h;
+frame->crop_right  = frame->width  - frame->crop_left - 
frame->crop_right - s->w;
+
+} else {
+frame->width  = s->w;
+frame->height = s->h;
+
+frame->data[0] += s->y * frame->linesize[0];
+frame->data[0] += s->x * s->max_step[0];
+
+if (!(desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & 
FF_PSEUDOPAL)) {
+for (i = 1; i < 3; i ++) {
+if (frame->data[i]) {
+frame->data[i] += (s->y >> s->vsub) * frame->linesize[i];
+frame->data[i] += (s->x * s->max_step[i]) >> s->hsub;
+}
 }
 }
-}
 
-/* alpha plane */
-if (frame->data[3]) {
-frame->data[3] += s->y * frame->linesize[3];
-frame->data[3] += s->x * s->max_step[3];
+/* alpha plane */
+if (frame->data[3]) {
+ 

[FFmpeg-devel] [PATCH v3 2/2] doc/indevs: Add example using cropping to capture part of a plane

2019-03-23 Thread Mark Thompson
---
 doc/indevs.texi | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 1d5ed65773..a4f0f608d7 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -910,6 +910,14 @@ Capture from CRTC ID 42 at 60fps, map the result to VAAPI, 
convert to NV12 and e
 ffmpeg -crtc_id 42 -framerate 60 -f kmsgrab -i - -vf 
'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v 
h264_vaapi output.mp4
 @end example
 
+@item
+To capture only part of a plane the output can be cropped - this can be used 
to capture
+a single window, as long as it has a known absolute position.  For example, to 
capture
+and encode the middle quarter of a 1920x1080 plane:
+@example
+ffmpeg -f kmsgrab -i - -vf 
'hwmap=derive_device=vaapi,crop=960:540:480:270,scale_vaapi=960:540:nv12' -c:v 
h264_vaapi output.mp4
+@end example
+
 @end itemize
 
 @section lavfi
-- 
2.19.2

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

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

Re: [FFmpeg-devel] [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Lynne
23 Mar 2019, 15:55 by barsn...@gmx.net:

> On Sat, Mar 16, 2019 at 17:34:49 +0100, Lynne wrote:
>
>> Subject: [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter 
>> and deemphasis
>>
> ^accelerated
>
> 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".
>

Fixed in attached version.
>From 2b5371b660812b4ee24b2beb90dea168dd9675e2 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Fri, 15 Mar 2019 14:37:31 +
Subject: [PATCH] aarch64/opusdsp: implement NEON accelerated postfilter and
 deemphasis

153372 UNITS in postfilter_c,   65536 runs,  0 skips
73164 UNITS in postfilter_neon,   65536 runs,  0 skips -> 2.1x speedup

80591 UNITS in deemphasis_c,  131072 runs,  0 skips
43969 UNITS in deemphasis_neon,  131072 runs,  0 skips -> 1.83x speedup

Total decoder speedup: ~15% on a Raspberry Pi 3 (from 28.1x to 33.5x realtime)

Deemphasis SIMD based on the following unrolling:
const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
float state = coeff;

for (int i = 0; i < len; i += 4) {
y[0] = x[0] + c1*state;
y[1] = x[1] + c2*state + c1*x[0];
y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];

state = y[3];
y += 4;
x += 4;
}

Unlike the x86 version, duplication is used instead of pslldq so
the structure and tables are different.
Same approach tested on x86 (3x pslldq -> vbroadcastss + shufps + pslldq)
had the same performance, so 3x pslldq was kept as vbroadcastss has a higher
latency.
---
 libavcodec/aarch64/Makefile   |   2 +
 libavcodec/aarch64/opusdsp_init.c |  35 +
 libavcodec/aarch64/opusdsp_neon.S | 113 ++
 libavcodec/opusdsp.c  |   3 +
 libavcodec/opusdsp.h  |   1 +
 5 files changed, 154 insertions(+)
 create mode 100644 libavcodec/aarch64/opusdsp_init.c
 create mode 100644 libavcodec/aarch64/opusdsp_neon.S

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 8bc8bc528c..00f93bf59f 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -15,6 +15,7 @@ OBJS-$(CONFIG_VP8DSP)   += aarch64/vp8dsp_init_aarch64.o
 OBJS-$(CONFIG_AAC_DECODER)  += aarch64/aacpsdsp_init_aarch64.o \
aarch64/sbrdsp_init_aarch64.o
 OBJS-$(CONFIG_DCA_DECODER)  += aarch64/synth_filter_init.o
+OBJS-$(CONFIG_OPUS_DECODER) += aarch64/opusdsp_init.o
 OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o
 OBJS-$(CONFIG_VC1DSP)   += aarch64/vc1dsp_init_aarch64.o
 OBJS-$(CONFIG_VORBIS_DECODER)   += aarch64/vorbisdsp_init.o
@@ -49,6 +50,7 @@ NEON-OBJS-$(CONFIG_VP8DSP)  += aarch64/vp8dsp_neon.o
 # decoders/encoders
 NEON-OBJS-$(CONFIG_AAC_DECODER) += aarch64/aacpsdsp_neon.o
 NEON-OBJS-$(CONFIG_DCA_DECODER) += aarch64/synth_filter_neon.o
+NEON-OBJS-$(CONFIG_OPUS_DECODER)+= aarch64/opusdsp_neon.o
 NEON-OBJS-$(CONFIG_VORBIS_DECODER)  += aarch64/vorbisdsp_neon.o
 NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o   \
aarch64/vp9itxfm_neon.o \
diff --git a/libavcodec/aarch64/opusdsp_init.c b/libavcodec/aarch64/opusdsp_init.c
new file mode 100644
index 00..cc6a1b672d
--- /dev/null
+++ b/libavcodec/aarch64/opusdsp_init.c
@@ -0,0 +1,35 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#include "libavutil/aarch64/cpu.h"
+#include "libavcodec/opusdsp.h"
+
+void ff_opus_postfilter_neon(float *data, int period, float *gains, int len);
+float ff_opus_deemphasis_neon(float *out, float *in, float coeff, int len);
+
+av_cold void ff_opus_dsp_init_aarch64(OpusDSP *ctx)
+{
+int cpu_flags = av_get_cpu_flags();
+
+if (have_neon(cpu_flags)) {
+ctx->postfilter = 

Re: [FFmpeg-devel] [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Lynne
23 Mar 2019, 15:04 by ceffm...@gmail.com:

> 2019-03-23 15:23 GMT+01:00, Lynne <> d...@lynne.ee > >:
>
>> 16 Mar 2019, 16:34 by >> d...@lynne.ee >> :
>>
>>> 153372 UNITS in postfilter_c,   65536 runs,  0 skips
>>> 73164 UNITS in postfilter_neon,   65536 runs,  0 skips -> 2.1x speedup
>>>
>>> 80591 UNITS in deemphasis_c,  131072 runs,  0 skips
>>> 43969 UNITS in deemphasis_neon,  131072 runs,  0 skips -> 1.83x
>>> speedup
>>>
>>> Total decoder speedup: ~15% on a Raspberry Pi 3 (from 28.1x to 33.5x
>>> realtime)
>>>
>>> Deemphasis SIMD based on the following unrolling:
>>> const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
>>> float state = coeff;
>>>
>>> for (int i = 0; i < len; i += 4) {
>>>  y[0] = x[0] + c1*state;
>>>  y[1] = x[1] + c2*state + c1*x[0];
>>>  y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
>>>  y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];
>>>
>>>  state = y[3];
>>>  y += 4;
>>>  x += 4;
>>> }
>>>
>>> Unlike the x86 version, duplication is used instead of pslldq so
>>> the structure and tables are different.
>>> Same approach tested on x86 (3x pslldq -> vbroadcastss + shufps + pslldq)
>>> had the same performance, so 3x pslldq was kept as vbroadcastss has a
>>> higher latency.
>>>
>>
>> Could someone review the patches?
>>
>
> Which toolchains did you test?
> (For compilation, not performance.)
>

gcc 8.2.1 on both aarch64 and x86-64
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Moritz Barsnick
On Sat, Mar 16, 2019 at 17:34:49 +0100, Lynne wrote:
> Subject: [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter 
> and deemphasis
   ^accelerated

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] Add GPU accelerated video crop filter

2019-03-23 Thread Tao Zhang
Done it. Thanks Steven and Timo

Timo Rothenpieler  于2019年3月23日周六 下午10:52写道:

> On 23.03.2019 14:46, Steven Liu wrote:
> > Documentation of the crop_cuda should be submitted together.
> >
> >
> > Thanks
> > Steven
> >
>
> True, forgot about that. Should be almost identical to that of the
> regular crop filter.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH][FFmpeg-devel v2] Add GPU accelerated video crop filter

2019-03-23 Thread UsingtcNower
Signed-off-by: UsingtcNower 
---
 Changelog   |   1 +
 configure   |   1 +
 doc/filters.texi|  31 +++
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/version.h   |   2 +-
 libavfilter/vf_crop_cuda.c  | 638 
 libavfilter/vf_crop_cuda.cu | 109 
 8 files changed, 783 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_crop_cuda.c
 create mode 100644 libavfilter/vf_crop_cuda.cu

diff --git a/Changelog b/Changelog
index ad7e82f..f224fc8 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
 - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
 - removed libndi-newtek
+- crop_cuda GPU accelerated video crop filter
 
 
 version 4.1:
diff --git a/configure b/configure
index 331393f..3f3ac2f 100755
--- a/configure
+++ b/configure
@@ -2973,6 +2973,7 @@ qsvvpp_select="qsv"
 vaapi_encode_deps="vaapi"
 v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
 
+crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
 hwupload_cuda_filter_deps="ffnvcodec"
 scale_npp_filter_deps="ffnvcodec libnpp"
 scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
diff --git a/doc/filters.texi b/doc/filters.texi
index 4ffb392..ee16a2d 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7415,6 +7415,37 @@ If the specified expression is not valid, it is kept at 
its current
 value.
 @end table
 
+@section crop_cuda
+
+Crop the input video to given dimensions, implemented in CUDA.
+
+It accepts the following parameters:
+
+@table @option
+
+@item w
+The width of the output video. It defaults to @code{iw}.
+This expression is evaluated only once during the filter
+configuration.
+
+@item h
+The height of the output video. It defaults to @code{ih}.
+This expression is evaluated only once during the filter
+configuration.
+
+@item x
+The horizontal position, in the input video, of the left edge of the output
+video. It defaults to @code{(in_w-out_w)/2}.
+This expression is evaluated only once during the filter
+configuration.
+
+@item y
+The vertical position, in the input video, of the top edge of the output video.
+It defaults to @code{(in_h-out_h)/2}.
+This expression is evaluated only once during the filter
+configuration.
+@end table
+
 @section cropdetect
 
 Auto-detect the crop size.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index fef6ec5..84df037 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
 OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
 OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
 OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
+OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o 
vf_crop_cuda.ptx.o
 OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
 OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
 OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index c51ae0f..550e545 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
 extern AVFilter ff_vf_coreimage;
 extern AVFilter ff_vf_cover_rect;
 extern AVFilter ff_vf_crop;
+extern AVFilter ff_vf_crop_cuda;
 extern AVFilter ff_vf_cropdetect;
 extern AVFilter ff_vf_cue;
 extern AVFilter ff_vf_curves;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index c71282c..5aa95f4 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR   7
 #define LIBAVFILTER_VERSION_MINOR  48
-#define LIBAVFILTER_VERSION_MICRO 100
+#define LIBAVFILTER_VERSION_MICRO 101
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_crop_cuda.c b/libavfilter/vf_crop_cuda.c
new file mode 100644
index 000..fc6a2a6
--- /dev/null
+++ b/libavfilter/vf_crop_cuda.c
@@ -0,0 +1,638 @@
+/*
+* Copyright (c) 2019, iQIYI CORPORATION. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

Re: [FFmpeg-devel] [PATCH 1/3] vp9_parser: Return stream properties

2019-03-23 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Mark Thompson
> Sent: Tuesday, March 19, 2019 8:18 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH 1/3] vp9_parser: Return stream properties
> 
> Rewrites the parser entirely, using CBS for header parsing.  A new
> entrypoint to the CBS code is added to avoid any copy overhead.
> ---
> On 18/03/2019 03:22, Li, Zhong wrote:
> > If you think that case can be resolved for VP9 parser, could you please
> provide more details?
> 
> Since all the infrastructure is already available it seemed easier to just do 
> it
> than to try to explain it all needs to fit together.
> 
> - Mark

Thank, it is quite helpful. Verified it with qsv vp9 decoder on KBL and it 
works.
(BTW, MJPEG parser should can reuse cbs code too.)

> 
> 
>  libavcodec/cbs_vp9.c|  62 ++
>  libavcodec/cbs_vp9.h|  12 +
>  libavcodec/vp9_parser.c | 113 +++-
>  3 files changed, 152 insertions(+), 35 deletions(-)
> 
> diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index
> 0b5f137ed8..237416a06f 100644
> --- a/libavcodec/cbs_vp9.c
> +++ b/libavcodec/cbs_vp9.c
> @@ -690,3 +690,65 @@ const CodedBitstreamType ff_cbs_type_vp9 = {
> 
>  .close = _vp9_close,
>  };
> +
> +int ff_cbs_vp9_parse_headers(CodedBitstreamContext *ctx,
> + VP9RawFrameHeader *header,
> + const uint8_t *data, size_t data_size) {
> +GetBitContext gbc;
> +uint8_t superframe_header;
> +int err;
> +
> +if (data_size < 1)
> +return AVERROR_INVALIDDATA;
> +
> +superframe_header = data[data_size - 1];
> +if ((superframe_header & 0xe0) == 0xc0) {

Define a macro should be helpful to read and maintain.

> +VP9RawSuperframeIndex sfi;
> +size_t index_size, pos;
> +int i;
> +
> +index_size = 2 + (((superframe_header & 0x18) >> 3) + 1) *
> +  ((superframe_header & 0x07) + 1);
> +if (index_size > data_size)
> +return AVERROR_INVALIDDATA;
> +
> +err = init_get_bits(, data + data_size - index_size,
> +8 * index_size);
> +if (err < 0)
> +return err;
> +
> +err = cbs_vp9_read_superframe_index(ctx, , );
> +if (err < 0)
> +return err;
> +
> +pos = 0;
> +for (i = 0; i <= sfi.frames_in_superframe_minus_1; i++) {
> +if (pos + sfi.frame_sizes[i] + index_size > data_size)
> +return AVERROR_INVALIDDATA;
> +
> +err = init_get_bits(, data + pos,
> +8 * sfi.frame_sizes[i]);
> +if (err < 0)
> +return err;
> +
> +memset(header, 0, sizeof(*header));
> +err = cbs_vp9_read_uncompressed_header(ctx, ,
> header);
> +if (err < 0)
> +return err;
> +
> +pos += sfi.frame_sizes[i];
> +}
> +
> +} else {
> +err = init_get_bits(, data, 8 * data_size);
> +if (err < 0)
> +return err;
> +
> +err = cbs_vp9_read_uncompressed_header(ctx, , header);
> +if (err < 0)
> +return err;
> +}
> +
> +return 0;
> +}
> diff --git a/libavcodec/cbs_vp9.h b/libavcodec/cbs_vp9.h index
> 4c9b2f880d..0b7e8dd71b 100644
> --- a/libavcodec/cbs_vp9.h
> +++ b/libavcodec/cbs_vp9.h
> @@ -214,4 +214,16 @@ typedef struct CodedBitstreamVP9Context {  }
> CodedBitstreamVP9Context;
> 
> 
> +/**
> + * Entrypoint for VP9 parser.
> + *
> + * Parses headers only in a VP9 frame, and does not require refcounting.
> + *
> + * The data may contain multiple frames in a superframe; all will be
> +parsed
> + * but the returned information will be for the final frame.
> + */
> +int ff_cbs_vp9_parse_headers(CodedBitstreamContext *ctx,
> + VP9RawFrameHeader *header,
> + const uint8_t *data, size_t data_size);
> +
>  #endif /* AVCODEC_CBS_VP9_H */
> diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c index
> c957a75667..5dd4d8d434 100644
> --- a/libavcodec/vp9_parser.c
> +++ b/libavcodec/vp9_parser.c
> @@ -1,8 +1,5 @@
>  /*
> - * VP9 compatible video decoder
> - *
> - * Copyright (C) 2013 Ronald S. Bultje 
> - * Copyright (C) 2013 Clément Bœsch 
> + * VP9 parser
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -21,50 +18,96 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
>   */
> 
> -#include "libavutil/intreadwrite.h"
> -#include "libavcodec/get_bits.h"
> +#include "libavutil/avassert.h"
> +#include "cbs.h"
> +#include "cbs_vp9.h"
>  #include "parser.h"
> 
> -static int parse(AVCodecParserContext *ctx,
> - AVCodecContext *avctx,
> - const uint8_t **out_data, int *out_size,
> - const uint8_t *data, int size)
> +typedef struct VP9ParserContext {
> 

Re: [FFmpeg-devel] [CLT2019] FFmpeg at Chemnitzer Linux-Tage

2019-03-23 Thread Thilo Borgmann
Hi,

> FFmpeg has been accepted for CLT 2019 in Chemnitz, Germany!
> This "Chemnitzer Linux Tage" will take place on 16th and 17th of March.
> You can find more details on their homepage:
> 
> https://chemnitzer.linux-tage.de/2019/en/

we returned from last weekends CLT. We again had a great time there with a lot 
of interested users and even some involvement in the capturing and streaming of 
the talks.

We presented the usual demos showing filters and capturing. We could acquire 
new hardware for the project during the fair, so we'll be ablte to 
significantly update our presentation for the next conference to run on that 
hardware.

Hotel and transportation has been handled like in the years before, so there 
will be some requests about that soon.

Thanks to everyone involved!
-Thilo
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Carl Eugen Hoyos
2019-03-23 15:23 GMT+01:00, Lynne :
> 16 Mar 2019, 16:34 by d...@lynne.ee:
>
>> 153372 UNITS in postfilter_c,   65536 runs,  0 skips
>> 73164 UNITS in postfilter_neon,   65536 runs,  0 skips -> 2.1x speedup
>>
>> 80591 UNITS in deemphasis_c,  131072 runs,  0 skips
>> 43969 UNITS in deemphasis_neon,  131072 runs,  0 skips -> 1.83x
>> speedup
>>
>> Total decoder speedup: ~15% on a Raspberry Pi 3 (from 28.1x to 33.5x
>> realtime)
>>
>> Deemphasis SIMD based on the following unrolling:
>> const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
>> float state = coeff;
>>
>> for (int i = 0; i < len; i += 4) {
>> y[0] = x[0] + c1*state;
>> y[1] = x[1] + c2*state + c1*x[0];
>> y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
>> y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];
>>
>> state = y[3];
>> y += 4;
>> x += 4;
>> }
>>
>> Unlike the x86 version, duplication is used instead of pslldq so
>> the structure and tables are different.
>> Same approach tested on x86 (3x pslldq -> vbroadcastss + shufps + pslldq)
>> had the same performance, so 3x pslldq was kept as vbroadcastss has a
>> higher latency.
>
> Could someone review the patches?

Which toolchains did you test?
(For compilation, not performance.)

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] News: Removal of libndi

2019-03-23 Thread Thilo Borgmann
Am 21.03.19 um 11:55 schrieb Michael Niedermayer:
> On Wed, Mar 20, 2019 at 05:41:31PM -0400, Ronald S. Bultje wrote:
>> Hi,
>>
>> On Wed, Mar 20, 2019 at 4:15 PM Gyan  wrote:
>>
>>>
>>>
>>> On 21-03-2019 01:32 AM, Marton Balint wrote:


 On Wed, 20 Mar 2019, Jean-Baptiste Kempf wrote:

> On Wed, 20 Mar 2019, at 20:52, Marton Balint wrote:
>> On Wed, 20 Mar 2019, Jean-Baptiste Kempf wrote:
>>
>>> On Wed, 20 Mar 2019, at 19:34, Marton Balint wrote:
 As I described in similar threads before, whether or not the
>> project want >> closed source support for NDI is a subjective issue,
>> please start a vote >> about the removal of libndi if you want to
>> seek this through.
>>>
>>> The removal of libndi is actually done and committed.
>>
>> That is just sad an unfair.
>
> Sad, maybe.
> Unfair, I disagree. If NDI wants to be in, they know what to do.

 It is unfair towards the people who expressied disapproval, yet this
 change was committed without neither vote nor consensus.
>>>
>>> +1. This was a political decision, not a technical one. A formal(-ish)
>>> survey should have happened on the ML.
>>>
>>
>> I agree we need a formal vote on this. I would like to set a wider project
>> policy w.r.t. closed-source software integration, this is just one instance
>> of a more general issue.

> I think there should have been a vote before pushing a commit as there where
> FFmpeg developers objecting to it.
> Ignoring people causes nothing good. Had there been a vote people would be
> alot less upset about it as everyones oppinion would be counted equally
> 
> It makes me unhappy that one FFmpeg developer apparently decided to leave
> the project already because of this. 
> I think we should fix this, make a proper policy, with a proper vote
> and then hopefully noone feels the need to leave.

+1

>>
>> Who wants to organize it?
> 
> Thilo organized the last vote, maybe he wants to do it ?
> but if noone else wants to do it i can do one too if people want and
> there is consensus who can vote
> If i search for "open source vote free" on google it points to 
> vote.heliosvoting.org as first hit
> this seems rather basic but for simple yes/no questions it could work
> maybe someone has a better suggestion we could use for more complex future
> cases that is multiple choice votes in teh future (schulze STV / CPO-STV
> for multiwinner or ScottishSTV (used by SPI), schulze method (used by debian)
> for one winner of N choices would be nice to have)  

Including for simple yes/no votes we can use the same LimeSurvey host we got 
provided from KDE for the survey. Also for anonymous votes.

If people want it, we can setup a poll anytime. Most important would be a list 
of people allowed to vote (as of mail subscribed to FFmpeg-devel).

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

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

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: fix range of values for Mastering Display Color Volume Metadata OBUs

2019-03-23 Thread James Almer
On 3/23/2019 9:46 AM, Mark Thompson wrote:
> On 21/03/2019 18:37, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>>  libavcodec/cbs_av1_syntax_template.c | 10 +-
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavcodec/cbs_av1_syntax_template.c 
>> b/libavcodec/cbs_av1_syntax_template.c
>> index 48f4fab514..93bba1e5ad 100644
>> --- a/libavcodec/cbs_av1_syntax_template.c
>> +++ b/libavcodec/cbs_av1_syntax_template.c
>> @@ -1637,15 +1637,15 @@ static int 
>> FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
>>  int err, i;
>>  
>>  for (i = 0; i < 3; i++) {
>> -fcs(16, primary_chromaticity_x[i], 0, 5, 1, i);
>> -fcs(16, primary_chromaticity_y[i], 0, 5, 1, i);
>> +fbs(16, primary_chromaticity_x[i], 1, i);
>> +fbs(16, primary_chromaticity_y[i], 1, i);
>>  }
>>  
>> -fc(16, white_point_chromaticity_x, 0, 5);
>> -fc(16, white_point_chromaticity_y, 0, 5);
>> +fb(16, white_point_chromaticity_x);
>> +fb(16, white_point_chromaticity_y);
>>  
>>  fc(32, luminance_max, 1, MAX_UINT_BITS(32));
>> -fc(32, luminance_min, 0, current->luminance_max >> 6);
>> +fc(32, luminance_min, 0, (current->luminance_max << 6) - 1);
> 
> << 6 in uint32_t can overflow.

What do you suggest? Casting to uint64_t will get the value clipped when
passed to ff_cbs_read_unsigned() and potentially result in a failed
range check.

> 
> Given the confusion in the previous value, maybe a comment to explain where 
> the upper bound for min is coming from too?
> 
>>  
>>  return 0;
>>  }
>>
> LGTM with that.
> 
> Thanks,
> 
> - Mark
> ___
> 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] Add GPU accelerated video crop filter

2019-03-23 Thread Timo Rothenpieler

On 23.03.2019 14:46, Steven Liu wrote:

Documentation of the crop_cuda should be submitted together.


Thanks
Steven



True, forgot about that. Should be almost identical to that of the 
regular crop filter.




smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 5/5] aarch64/opusdsp: implement NEON accerelated postfilter and deemphasis

2019-03-23 Thread Lynne
16 Mar 2019, 16:34 by d...@lynne.ee:

> 153372 UNITS in postfilter_c,   65536 runs,  0 skips
> 73164 UNITS in postfilter_neon,   65536 runs,  0 skips -> 2.1x speedup
>
> 80591 UNITS in deemphasis_c,  131072 runs,  0 skips
> 43969 UNITS in deemphasis_neon,  131072 runs,  0 skips -> 1.83x speedup
>
> Total decoder speedup: ~15% on a Raspberry Pi 3 (from 28.1x to 33.5x realtime)
>
> Deemphasis SIMD based on the following unrolling:
> const float c1 = CELT_EMPH_COEFF, c2 = c1*c1, c3 = c2*c1, c4 = c3*c1;
> float state = coeff;
>
> for (int i = 0; i < len; i += 4) {
>     y[0] = x[0] + c1*state;
>     y[1] = x[1] + c2*state + c1*x[0];
>     y[2] = x[2] + c3*state + c1*x[1] + c2*x[0];
>     y[3] = x[3] + c4*state + c1*x[2] + c2*x[1] + c3*x[0];
>
>     state = y[3];
>     y += 4;
>     x += 4;
> }
>
> Unlike the x86 version, duplication is used instead of pslldq so
> the structure and tables are different.
> Same approach tested on x86 (3x pslldq -> vbroadcastss + shufps + pslldq)
> had the same performance, so 3x pslldq was kept as vbroadcastss has a higher
> latency.
>

Could someone review the 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] [PATCH v7] Improved the performance of 1 decode + N filter graphs and adaptive bitrate.

2019-03-23 Thread Mark Thompson
On 21/03/2019 15:09, Shaofei Wang wrote:
> It enabled MULTIPLE SIMPLE filter graph concurrency, which bring above about
> 4%~20% improvement in some 1:N scenarios by CPU or GPU acceleration
> 
> ...> 
> Signed-off-by: Wang, Shaofei 
> Reviewed-by: Michael Niedermayer 
> Reviewed-by: Mark Thompson 

The reviewed-by annotation generally implies review approval for a patch, which 
I don't think is true for either of the stated people.

> ---
> The patch will only effect on multiple SIMPLE filter graphs pipeline,
> Passed fate and refine the possible data race,
> AFL tested, without introducing extra crashs/hangs:
> 
> ...
> 
>  fftools/ffmpeg.c | 172 
> +--
>  fftools/ffmpeg.h |  13 +
>  2 files changed, 169 insertions(+), 16 deletions(-)> 
> ...
> @@ -1419,12 +1436,13 @@ static void finish_output_stream(OutputStream *ost)
>   *
>   * @return  0 for success, <0 for severe errors
>   */
> -static int reap_filters(int flush)
> +static int reap_filters(int flush, InputFilter * ifilter)
>  {
>  AVFrame *filtered_frame = NULL;
>  int i;
>  
> -/* Reap all buffers present in the buffer sinks */
> +/* Reap all buffers present in the buffer sinks or just reap specified
> + * buffer which related with the filter graph who got ifilter as input*/
>  for (i = 0; i < nb_output_streams; i++) {
>  OutputStream *ost = output_streams[i];
>  OutputFile*of = output_files[ost->file_index];
> @@ -1432,13 +1450,25 @@ static int reap_filters(int flush)
>  AVCodecContext *enc = ost->enc_ctx;
>  int ret = 0;
>  
> +if (ifilter && abr_threads_enabled)
> +if (ost != ifilter->graph->outputs[0])
> +continue;

This comparison is always false.

src/fftools/ffmpeg.c: In function ‘reap_filters’:
src/fftools/ffmpeg.c:1457:21: warning: comparison of distinct pointer types 
lacks a cast
 if (ost != ifilter->graph->outputs[0])
 ^~

> ...

The output is entirely serialised in this patch because of it, which I don't 
think was intended.  Doing that certainly avoid data races, but much of the 
locking is redundant and the improvement numbers stated in the commit message 
for earlier versions do not apply.

- Mark
___
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 GPU accelerated video crop filter

2019-03-23 Thread Steven Liu


> 在 2019年3月23日,19:31,UsingtcNower  写道:
> 
> Signed-off-by: UsingtcNower 
> ---
> Changelog   |   1 +
> configure   |   1 +
> libavfilter/Makefile|   1 +
> libavfilter/allfilters.c|   1 +
> libavfilter/vf_crop_cuda.c  | 638 
> libavfilter/vf_crop_cuda.cu | 109 
> 6 files changed, 751 insertions(+)
> create mode 100644 libavfilter/vf_crop_cuda.c
> create mode 100644 libavfilter/vf_crop_cuda.cu
> 
> diff --git a/Changelog b/Changelog
> index ad7e82f..f224fc8 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -20,6 +20,7 @@ version :
> - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
> - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
> - removed libndi-newtek
> +- crop_cuda GPU accelerated video crop filter
> 
> 
> version 4.1:
> diff --git a/configure b/configure
> index 331393f..88f1e91 100755
> --- a/configure
> +++ b/configure
> @@ -2978,6 +2978,7 @@ scale_npp_filter_deps="ffnvcodec libnpp"
> scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
> thumbnail_cuda_filter_deps="ffnvcodec cuda_nvcc"
> transpose_npp_filter_deps="ffnvcodec libnpp"
> +crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
> 
> amf_deps_any="libdl LoadLibrary"
> nvenc_deps="ffnvcodec"
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index fef6ec5..84df037 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
> OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
> OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
> OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
> +OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o 
> vf_crop_cuda.ptx.o
> OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
> OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
> OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index c51ae0f..550e545 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
> extern AVFilter ff_vf_coreimage;
> extern AVFilter ff_vf_cover_rect;
> extern AVFilter ff_vf_crop;
> +extern AVFilter ff_vf_crop_cuda;
> extern AVFilter ff_vf_cropdetect;
> extern AVFilter ff_vf_cue;
> extern AVFilter ff_vf_curves;
> diff --git a/libavfilter/vf_crop_cuda.c b/libavfilter/vf_crop_cuda.c
> new file mode 100644
> index 000..5a97863
> --- /dev/null
> +++ b/libavfilter/vf_crop_cuda.c
> @@ -0,0 +1,638 @@
> +/*
> +* Copyright (c) 2019, iQIYI CORPORATION. All rights reserved.
> +*
> +* Permission is hereby granted, free of charge, to any person obtaining a
> +* copy of this software and associated documentation files (the "Software"),
> +* to deal in the Software without restriction, including without limitation
> +* the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +* and/or sell copies of the Software, and to permit persons to whom the
> +* Software is furnished to do so, subject to the following conditions:
> +*
> +* The above copyright notice and this permission notice shall be included in
> +* all copies or substantial portions of the Software.
> +*
> +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> +* DEALINGS IN THE SOFTWARE.
> +*/
> +
> +#include 
> +#include 
> +
> +#include "libavutil/avstring.h"
> +#include "libavutil/common.h"
> +#include "libavutil/hwcontext.h"
> +#include "libavutil/hwcontext_cuda_internal.h"
> +#include "libavutil/cuda_check.h"
> +#include "libavutil/internal.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
> +#include "libavutil/eval.h"
> +
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "video.h"
> +
> +static const char *const var_names[] = {
> +"in_w", "iw",   ///< width  of the input video
> +"in_h", "ih",   ///< height of the input video
> +"out_w", "ow",  ///< width  of the cropped video
> +"out_h", "oh",  ///< height of the cropped video
> +"x",
> +"y",
> +NULL
> +};
> +
> +enum var_name {
> +VAR_IN_W,  VAR_IW,
> +VAR_IN_H,  VAR_IH,
> +VAR_OUT_W, VAR_OW,
> +VAR_OUT_H, VAR_OH,
> +VAR_X,
> +VAR_Y,
> +VAR_VARS_NB
> +};
> +
> +static const enum AVPixelFormat supported_formats[] = {
> +AV_PIX_FMT_YUV420P,
> +AV_PIX_FMT_NV12,
> +AV_PIX_FMT_YUV444P,
> +AV_PIX_FMT_P010,
> +AV_PIX_FMT_P016
> +};
> +
> +#define DIV_UP(a, b) ( ((a) + 

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/tiff: Multi-page support

2019-03-23 Thread Carl Eugen Hoyos
2019-03-23 13:34 GMT+01:00, Paul B Mahol :
> On 3/23/19, Carl Eugen Hoyos  wrote:
>> 2019-03-23 9:11 GMT+01:00, Paul B Mahol :
>>> On 3/22/19, Carl Eugen Hoyos  wrote:
 2019-03-22 15:50 GMT+01:00, velocit...@gmail.com :
> From: Nick Renieris 
>
> Option "-page N" (page index N starts from 1) can now
> be used to specify which TIFF page/subfile to decode.

 What is the current behaviour?
 Shouldn't the decoder output all pages as for a video file?
>>>
>>> How?
>>
>> I would have suggested decoder flush.

The word is probably "drain".

> What? Can you elaborate what you think?

Isn't there a return value that leads to subsequent calls of
AVCodec->decode()?

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] avcodec/cbs_av1: fix range of values for Mastering Display Color Volume Metadata OBUs

2019-03-23 Thread Mark Thompson
On 21/03/2019 18:37, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  libavcodec/cbs_av1_syntax_template.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/cbs_av1_syntax_template.c 
> b/libavcodec/cbs_av1_syntax_template.c
> index 48f4fab514..93bba1e5ad 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1637,15 +1637,15 @@ static int 
> FUNC(metadata_hdr_mdcv)(CodedBitstreamContext *ctx, RWContext *rw,
>  int err, i;
>  
>  for (i = 0; i < 3; i++) {
> -fcs(16, primary_chromaticity_x[i], 0, 5, 1, i);
> -fcs(16, primary_chromaticity_y[i], 0, 5, 1, i);
> +fbs(16, primary_chromaticity_x[i], 1, i);
> +fbs(16, primary_chromaticity_y[i], 1, i);
>  }
>  
> -fc(16, white_point_chromaticity_x, 0, 5);
> -fc(16, white_point_chromaticity_y, 0, 5);
> +fb(16, white_point_chromaticity_x);
> +fb(16, white_point_chromaticity_y);
>  
>  fc(32, luminance_max, 1, MAX_UINT_BITS(32));
> -fc(32, luminance_min, 0, current->luminance_max >> 6);
> +fc(32, luminance_min, 0, (current->luminance_max << 6) - 1);

<< 6 in uint32_t can overflow.

Given the confusion in the previous value, maybe a comment to explain where the 
upper bound for min is coming from too?

>  
>  return 0;
>  }
> 
LGTM with that.

Thanks,

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

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

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/tiff: Multi-page support

2019-03-23 Thread Paul B Mahol
On 3/23/19, Carl Eugen Hoyos  wrote:
> 2019-03-23 9:11 GMT+01:00, Paul B Mahol :
>> On 3/22/19, Carl Eugen Hoyos  wrote:
>>> 2019-03-22 15:50 GMT+01:00, velocit...@gmail.com :
 From: Nick Renieris 

 Option "-page N" (page index N starts from 1) can now
 be used to specify which TIFF page/subfile to decode.
>>>
>>> What is the current behaviour?
>>> Shouldn't the decoder output all pages as for a video file?
>>
>> How?
>
> I would have suggested decoder flush.
>

What? Can you elaborate what you think?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/tiff: Multi-page support

2019-03-23 Thread Carl Eugen Hoyos
2019-03-23 9:11 GMT+01:00, Paul B Mahol :
> On 3/22/19, Carl Eugen Hoyos  wrote:
>> 2019-03-22 15:50 GMT+01:00, velocit...@gmail.com :
>>> From: Nick Renieris 
>>>
>>> Option "-page N" (page index N starts from 1) can now
>>> be used to specify which TIFF page/subfile to decode.
>>
>> What is the current behaviour?
>> Shouldn't the decoder output all pages as for a video file?
>
> How?

I would have suggested decoder flush.

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] [FFmpeg-cvslog] lavu/opencl: replace va_ext.h with standard name

2019-03-23 Thread Mark Thompson
On 22/03/2019 01:40, Ruiling Song wrote:
> ffmpeg | branch: master | Ruiling Song  | Fri Nov 23 
> 13:39:12 2018 +0800| [61cb505d18b8a335bd118d88c05b9daf40eb5f9b] | committer: 
> Ruiling Song
> 
> lavu/opencl: replace va_ext.h with standard name
> 
> Khronos OpenCL header (https://github.com/KhronosGroup/OpenCL-Headers)
> uses cl_va_api_media_sharing_intel.h. And Intel's official OpenCL driver
> for Intel GPU (https://github.com/intel/compute-runtime) was compiled
> against Khronos OpenCL header. So it's better to align with Khronos.
> 
> Signed-off-by: Ruiling Song 
> 
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61cb505d18b8a335bd118d88c05b9daf40eb5f9b
> ---
> 
>  configure| 2 +-
>  libavutil/hwcontext_opencl.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index a817479559..331393f8d5 100755
> --- a/configure
> +++ b/configure
> @@ -6472,7 +6472,7 @@ fi
>  
>  if enabled_all opencl vaapi ; then
>  enabled opencl_drm_beignet && enable opencl_vaapi_beignet
> -check_type "CL/cl.h CL/va_ext.h" 
> "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
> +check_type "CL/cl.h CL/cl_va_api_media_sharing_intel.h" 
> "clCreateFromVA_APIMediaSurfaceINTEL_fn" &&
>  enable opencl_vaapi_intel_media
>  fi
>  
> diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
> index d3df6221c4..b116c5b708 100644
> --- a/libavutil/hwcontext_opencl.c
> +++ b/libavutil/hwcontext_opencl.c
> @@ -50,7 +50,7 @@
>  #include 
>  #endif
>  #include 
> -#include 
> +#include 
>  #include "hwcontext_vaapi.h"
>  #endif
>  

This broke the build when both are available.

$ make
CC  libavutil/hwcontext_opencl.o
src/libavutil/hwcontext_opencl.c: In function ‘opencl_device_derive’:
src/libavutil/hwcontext_opencl.c:1236:5: error: duplicate case value
 case AV_HWDEVICE_TYPE_VAAPI:
 ^~~~
src/libavutil/hwcontext_opencl.c:1205:5: note: previously used here
 case AV_HWDEVICE_TYPE_VAAPI:
 ^~~~
src/libavutil/hwcontext_opencl.c: In function ‘opencl_map_to’:
src/libavutil/hwcontext_opencl.c:2831:5: error: duplicate case value
 case AV_PIX_FMT_VAAPI:
 ^~~~
src/libavutil/hwcontext_opencl.c:2825:5: note: previously used here
 case AV_PIX_FMT_VAAPI:
 ^~~~
src/libavutil/hwcontext_opencl.c: In function ‘opencl_frames_derive_to’:
src/libavutil/hwcontext_opencl.c:2873:5: error: duplicate case value
 case AV_HWDEVICE_TYPE_VAAPI:
 ^~~~
src/libavutil/hwcontext_opencl.c:2866:5: note: previously used here
 case AV_HWDEVICE_TYPE_VAAPI:
 ^~~~
make: *** [ffbuild/common.mak:60: libavutil/hwcontext_opencl.o] Error 1
make: Target 'all' not remade because of errors.

$ cat config.h | grep HAVE_OPENCL
#define HAVE_OPENCL_D3D11 0
#define HAVE_OPENCL_DRM_ARM 0
#define HAVE_OPENCL_DRM_BEIGNET 1
#define HAVE_OPENCL_DXVA2 0
#define HAVE_OPENCL_VAAPI_BEIGNET 1
#define HAVE_OPENCL_VAAPI_INTEL_MEDIA 1


I think in general the Beignet mapping is more useful if present since it has 
far fewer constraints, so perhaps disable this one if Beignet is there?

Alternatively, some sort of runtime detection.  Not sure how that should fit 
in, though.

- Mark
___
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 GPU accelerated video crop filter

2019-03-23 Thread Tao Zhang
Got it and corrected. Thanks Timo

Timo Rothenpieler  于2019年3月23日周六 下午7:53写道:

> On 23.03.2019 12:31, UsingtcNower wrote:
>  > diff --git a/configure b/configure
>  > index 331393f..88f1e91 100755
>  > --- a/configure
>  > +++ b/configure
>  > @@ -2978,6 +2978,7 @@ scale_npp_filter_deps="ffnvcodec libnpp"
>  >   scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
>  >   thumbnail_cuda_filter_deps="ffnvcodec cuda_nvcc"
>  >   transpose_npp_filter_deps="ffnvcodec libnpp"
>  > +crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
>
> These are generally kept in alphabetical order.
>
> > +static av_cold int init_processing_chain(AVFilterContext *ctx, int
> in_width, int in_height,
> > + int out_width, int out_height,
> > + int left, int top)
> > +{
> > +CUDACropContext *s = ctx->priv;
> > +
> > +AVHWFramesContext *in_frames_ctx;
> > +
> > +enum AVPixelFormat in_format;
> > +enum AVPixelFormat out_format;
> > +int ret;
> > +
> > +/* check that we have a hw context */
> > +if (!ctx->inputs[0]->hw_frames_ctx) {
> > +av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n");
> > +return AVERROR(EINVAL);
> > +}
> > +in_frames_ctx =
> (AVHWFramesContext*)ctx->inputs[0]->hw_frames_ctx->data;
> > +in_format = in_frames_ctx->sw_format;
> > +out_format= (s->format == AV_PIX_FMT_NONE) ? in_format :
> s->format;
> > +
> > +if (!format_is_supported(in_format)) {
> > +av_log(ctx, AV_LOG_ERROR, "Unsupported input format: %s\n",
> > +   av_get_pix_fmt_name(in_format));
> > +return AVERROR(ENOSYS);
> > +}
> > +if (!format_is_supported(out_format)) {
> > +av_log(ctx, AV_LOG_ERROR, "Unsupported output format: %s\n",
> > +   av_get_pix_fmt_name(out_format));
> > +return AVERROR(ENOSYS);
> > +}
> > +
> > +if (in_width == out_width && in_height == out_height)
> > +s->passthrough = 1;
> > +
> > +s->in_fmt = in_format;
> > +s->out_fmt = out_format;
> > +
> > +s->planes_in[0].width   = in_width;
> > +s->planes_in[0].height  = in_height;
> > +s->planes_out[0].width  = out_width;
> > +s->planes_out[0].height = out_height;
> > +s->planes_in[0].left = left;
> > +s->planes_in[0].top = top;
> > +s->planes_out[0].left = 0;
> > +s->planes_out[0].top = 0;
>
> This is a nit, but why not align all of them?
>
> Also missing a version bump. I'd say bumping lavf micro version is enough.
>
>
> Otherwise this looks good to me. Will give it a test later, and I don't
> really see any reason not to merge this.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
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 GPU accelerated video crop filter

2019-03-23 Thread UsingtcNower
Signed-off-by: UsingtcNower 
---
 Changelog   |   1 +
 configure   |   1 +
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/version.h   |   2 +-
 libavfilter/vf_crop_cuda.c  | 638 
 libavfilter/vf_crop_cuda.cu | 109 
 7 files changed, 752 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/vf_crop_cuda.c
 create mode 100644 libavfilter/vf_crop_cuda.cu

diff --git a/Changelog b/Changelog
index ad7e82f..f224fc8 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
 - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
 - removed libndi-newtek
+- crop_cuda GPU accelerated video crop filter
 
 
 version 4.1:
diff --git a/configure b/configure
index 331393f..3f3ac2f 100755
--- a/configure
+++ b/configure
@@ -2973,6 +2973,7 @@ qsvvpp_select="qsv"
 vaapi_encode_deps="vaapi"
 v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
 
+crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
 hwupload_cuda_filter_deps="ffnvcodec"
 scale_npp_filter_deps="ffnvcodec libnpp"
 scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index fef6ec5..84df037 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
 OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
 OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
 OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
+OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o 
vf_crop_cuda.ptx.o
 OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
 OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
 OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index c51ae0f..550e545 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
 extern AVFilter ff_vf_coreimage;
 extern AVFilter ff_vf_cover_rect;
 extern AVFilter ff_vf_crop;
+extern AVFilter ff_vf_crop_cuda;
 extern AVFilter ff_vf_cropdetect;
 extern AVFilter ff_vf_cue;
 extern AVFilter ff_vf_curves;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index c71282c..5aa95f4 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR   7
 #define LIBAVFILTER_VERSION_MINOR  48
-#define LIBAVFILTER_VERSION_MICRO 100
+#define LIBAVFILTER_VERSION_MICRO 101
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_crop_cuda.c b/libavfilter/vf_crop_cuda.c
new file mode 100644
index 000..fc6a2a6
--- /dev/null
+++ b/libavfilter/vf_crop_cuda.c
@@ -0,0 +1,638 @@
+/*
+* Copyright (c) 2019, iQIYI CORPORATION. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#include 
+#include 
+
+#include "libavutil/avstring.h"
+#include "libavutil/common.h"
+#include "libavutil/hwcontext.h"
+#include "libavutil/hwcontext_cuda_internal.h"
+#include "libavutil/cuda_check.h"
+#include "libavutil/internal.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/eval.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+static const char *const var_names[] = {
+"in_w", "iw",   ///< width  of the input video
+"in_h", "ih",   ///< height of the input video
+"out_w", "ow",  ///< width  of the cropped video
+"out_h", "oh",  ///< height of the cropped video
+"x",
+"y",
+NULL
+};
+
+enum var_name {
+VAR_IN_W,  VAR_IW,
+VAR_IN_H,  VAR_IH,
+VAR_OUT_W, VAR_OW,
+VAR_OUT_H, VAR_OH,
+VAR_X,
+VAR_Y,
+

Re: [FFmpeg-devel] [PATCH] Add GPU accelerated video crop filter

2019-03-23 Thread Timo Rothenpieler

On 23.03.2019 12:31, UsingtcNower wrote:
> diff --git a/configure b/configure
> index 331393f..88f1e91 100755
> --- a/configure
> +++ b/configure
> @@ -2978,6 +2978,7 @@ scale_npp_filter_deps="ffnvcodec libnpp"
>   scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
>   thumbnail_cuda_filter_deps="ffnvcodec cuda_nvcc"
>   transpose_npp_filter_deps="ffnvcodec libnpp"
> +crop_cuda_filter_deps="ffnvcodec cuda_nvcc"

These are generally kept in alphabetical order.


+static av_cold int init_processing_chain(AVFilterContext *ctx, int in_width, 
int in_height,
+ int out_width, int out_height,
+ int left, int top)
+{
+CUDACropContext *s = ctx->priv;
+
+AVHWFramesContext *in_frames_ctx;
+
+enum AVPixelFormat in_format;
+enum AVPixelFormat out_format;
+int ret;
+
+/* check that we have a hw context */
+if (!ctx->inputs[0]->hw_frames_ctx) {
+av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n");
+return AVERROR(EINVAL);
+}
+in_frames_ctx = (AVHWFramesContext*)ctx->inputs[0]->hw_frames_ctx->data;
+in_format = in_frames_ctx->sw_format;
+out_format= (s->format == AV_PIX_FMT_NONE) ? in_format : s->format;
+
+if (!format_is_supported(in_format)) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported input format: %s\n",
+   av_get_pix_fmt_name(in_format));
+return AVERROR(ENOSYS);
+}
+if (!format_is_supported(out_format)) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported output format: %s\n",
+   av_get_pix_fmt_name(out_format));
+return AVERROR(ENOSYS);
+}
+
+if (in_width == out_width && in_height == out_height)
+s->passthrough = 1;
+
+s->in_fmt = in_format;
+s->out_fmt = out_format;
+
+s->planes_in[0].width   = in_width;
+s->planes_in[0].height  = in_height;
+s->planes_out[0].width  = out_width;
+s->planes_out[0].height = out_height;
+s->planes_in[0].left = left;
+s->planes_in[0].top = top;
+s->planes_out[0].left = 0;
+s->planes_out[0].top = 0;


This is a nit, but why not align all of them?

Also missing a version bump. I'd say bumping lavf micro version is enough.


Otherwise this looks good to me. Will give it a test later, and I don't 
really see any reason not to merge this.




smime.p7s
Description: S/MIME Cryptographic 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 GPU accelerated video crop filter

2019-03-23 Thread UsingtcNower
Signed-off-by: UsingtcNower 
---
 Changelog| 1 +
 configure| 1 +
 libavfilter/Makefile | 1 +
 libavfilter/allfilters.c | 1 +
 4 files changed, 4 insertions(+)

diff --git a/Changelog b/Changelog
index ad7e82f..f224fc8 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
 - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
 - removed libndi-newtek
+- crop_cuda GPU accelerated video crop filter
 
 
 version 4.1:
diff --git a/configure b/configure
index 331393f..88f1e91 100755
--- a/configure
+++ b/configure
@@ -2978,6 +2978,7 @@ scale_npp_filter_deps="ffnvcodec libnpp"
 scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
 thumbnail_cuda_filter_deps="ffnvcodec cuda_nvcc"
 transpose_npp_filter_deps="ffnvcodec libnpp"
+crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
 
 amf_deps_any="libdl LoadLibrary"
 nvenc_deps="ffnvcodec"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index fef6ec5..84df037 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
 OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
 OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
 OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
+OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o 
vf_crop_cuda.ptx.o
 OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
 OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
 OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index c51ae0f..550e545 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
 extern AVFilter ff_vf_coreimage;
 extern AVFilter ff_vf_cover_rect;
 extern AVFilter ff_vf_crop;
+extern AVFilter ff_vf_crop_cuda;
 extern AVFilter ff_vf_cropdetect;
 extern AVFilter ff_vf_cue;
 extern AVFilter ff_vf_curves;
-- 
1.8.3.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] Add GPU accelerated video crop filter

2019-03-23 Thread UsingtcNower
Signed-off-by: UsingtcNower 
---
 Changelog   |   1 +
 configure   |   1 +
 libavfilter/Makefile|   1 +
 libavfilter/allfilters.c|   1 +
 libavfilter/vf_crop_cuda.c  | 638 
 libavfilter/vf_crop_cuda.cu | 109 
 6 files changed, 751 insertions(+)
 create mode 100644 libavfilter/vf_crop_cuda.c
 create mode 100644 libavfilter/vf_crop_cuda.cu

diff --git a/Changelog b/Changelog
index ad7e82f..f224fc8 100644
--- a/Changelog
+++ b/Changelog
@@ -20,6 +20,7 @@ version :
 - libaribb24 based ARIB STD-B24 caption support (profiles A and C)
 - Support decoding of HEVC 4:4:4 content in nvdec and cuviddec
 - removed libndi-newtek
+- crop_cuda GPU accelerated video crop filter
 
 
 version 4.1:
diff --git a/configure b/configure
index 331393f..88f1e91 100755
--- a/configure
+++ b/configure
@@ -2978,6 +2978,7 @@ scale_npp_filter_deps="ffnvcodec libnpp"
 scale_cuda_filter_deps="ffnvcodec cuda_nvcc"
 thumbnail_cuda_filter_deps="ffnvcodec cuda_nvcc"
 transpose_npp_filter_deps="ffnvcodec libnpp"
+crop_cuda_filter_deps="ffnvcodec cuda_nvcc"
 
 amf_deps_any="libdl LoadLibrary"
 nvenc_deps="ffnvcodec"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index fef6ec5..84df037 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -187,6 +187,7 @@ OBJS-$(CONFIG_COPY_FILTER)   += vf_copy.o
 OBJS-$(CONFIG_COREIMAGE_FILTER)  += vf_coreimage.o
 OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
 OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
+OBJS-$(CONFIG_CROP_CUDA_FILTER)  += vf_crop_cuda.o 
vf_crop_cuda.ptx.o
 OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
 OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
 OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index c51ae0f..550e545 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -175,6 +175,7 @@ extern AVFilter ff_vf_copy;
 extern AVFilter ff_vf_coreimage;
 extern AVFilter ff_vf_cover_rect;
 extern AVFilter ff_vf_crop;
+extern AVFilter ff_vf_crop_cuda;
 extern AVFilter ff_vf_cropdetect;
 extern AVFilter ff_vf_cue;
 extern AVFilter ff_vf_curves;
diff --git a/libavfilter/vf_crop_cuda.c b/libavfilter/vf_crop_cuda.c
new file mode 100644
index 000..5a97863
--- /dev/null
+++ b/libavfilter/vf_crop_cuda.c
@@ -0,0 +1,638 @@
+/*
+* Copyright (c) 2019, iQIYI CORPORATION. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#include 
+#include 
+
+#include "libavutil/avstring.h"
+#include "libavutil/common.h"
+#include "libavutil/hwcontext.h"
+#include "libavutil/hwcontext_cuda_internal.h"
+#include "libavutil/cuda_check.h"
+#include "libavutil/internal.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/eval.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+static const char *const var_names[] = {
+"in_w", "iw",   ///< width  of the input video
+"in_h", "ih",   ///< height of the input video
+"out_w", "ow",  ///< width  of the cropped video
+"out_h", "oh",  ///< height of the cropped video
+"x",
+"y",
+NULL
+};
+
+enum var_name {
+VAR_IN_W,  VAR_IW,
+VAR_IN_H,  VAR_IH,
+VAR_OUT_W, VAR_OW,
+VAR_OUT_H, VAR_OH,
+VAR_X,
+VAR_Y,
+VAR_VARS_NB
+};
+
+static const enum AVPixelFormat supported_formats[] = {
+AV_PIX_FMT_YUV420P,
+AV_PIX_FMT_NV12,
+AV_PIX_FMT_YUV444P,
+AV_PIX_FMT_P010,
+AV_PIX_FMT_P016
+};
+
+#define DIV_UP(a, b) ( ((a) + (b) - 1) / (b) )
+#define ALIGN_UP(a, b) (((a) + (b) - 1) & ~((b) - 1))
+#define NUM_BUFFERS 2
+#define BLOCKX 32
+#define BLOCKY 16
+
+#define CHECK_CU(x) FF_CUDA_CHECK_DL(ctx, s->hwctx->internal->cuda_dl, x)
+
+typedef struct CUDACropContext {
+const AVClass *class;
+

[FFmpeg-devel] [PATCH v2] avfilter/src_movie: change the deprecate API to new decode api

2019-03-23 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavfilter/src_movie.c | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index bcabfcc4c2..65561a3959 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -172,8 +172,6 @@ static int open_stream(void *log, MovieStream *st)
 if (ret < 0)
 return ret;
 
-st->codec_ctx->refcounted_frames = 1;
-
 if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
 av_log(log, AV_LOG_ERROR, "Failed to open codec\n");
 return ret;
@@ -524,17 +522,22 @@ static int movie_push_frame(AVFilterContext *ctx, 
unsigned out_id)
 return AVERROR(ENOMEM);
 
 frame_type = st->st->codecpar->codec_type;
-switch (frame_type) {
-case AVMEDIA_TYPE_VIDEO:
-ret = avcodec_decode_video2(st->codec_ctx, frame, _frame, pkt);
-break;
-case AVMEDIA_TYPE_AUDIO:
-ret = avcodec_decode_audio4(st->codec_ctx, frame, _frame, pkt);
-break;
-default:
+if (frame_type == AVMEDIA_TYPE_VIDEO || frame_type == AVMEDIA_TYPE_AUDIO) {
+ret = avcodec_send_packet(st->codec_ctx, pkt);
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
+ret = 0;
+}
+if (ret >= 0) {
+ret = avcodec_receive_frame(st->codec_ctx, frame);
+if (ret >= 0)
+got_frame = 1;
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+ret = 0;
+}
+} else {
 ret = AVERROR(ENOSYS);
-break;
 }
+
 if (ret < 0) {
 av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret));
 av_frame_free();
-- 
2.15.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] avfilter/src_movie: change the deprecate API to new decode api

2019-03-23 Thread Steven Liu
Signed-off-by: Steven Liu 
---
 libavfilter/src_movie.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index bcabfcc4c2..c313d714fe 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -172,8 +172,6 @@ static int open_stream(void *log, MovieStream *st)
 if (ret < 0)
 return ret;
 
-st->codec_ctx->refcounted_frames = 1;
-
 if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
 av_log(log, AV_LOG_ERROR, "Failed to open codec\n");
 return ret;
@@ -524,17 +522,17 @@ static int movie_push_frame(AVFilterContext *ctx, 
unsigned out_id)
 return AVERROR(ENOMEM);
 
 frame_type = st->st->codecpar->codec_type;
-switch (frame_type) {
-case AVMEDIA_TYPE_VIDEO:
-ret = avcodec_decode_video2(st->codec_ctx, frame, _frame, pkt);
-break;
-case AVMEDIA_TYPE_AUDIO:
-ret = avcodec_decode_audio4(st->codec_ctx, frame, _frame, pkt);
-break;
-default:
+if (frame_type == AVMEDIA_TYPE_VIDEO || frame_type == AVMEDIA_TYPE_AUDIO) {
+ret = avcodec_send_packet(st->codec_ctx, pkt);
+ret = avcodec_receive_frame(st->codec_ctx, frame);
+if (ret >= 0)
+got_frame = 1;
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+ret = 0;
+} else {
 ret = AVERROR(ENOSYS);
-break;
 }
+
 if (ret < 0) {
 av_log(ctx, AV_LOG_WARNING, "Decode error: %s\n", av_err2str(ret));
 av_frame_free();
-- 
2.15.1



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

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

Re: [FFmpeg-devel] [PATCH] avformat/flvdec: added support for KUX container

2019-03-23 Thread Swaraj Hota
Oh, I really wished to do it ':D
Anyway, thanks :) Tell me if any other change can be made.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/tiff: Multi-page support

2019-03-23 Thread Paul B Mahol
On 3/22/19, Carl Eugen Hoyos  wrote:
> 2019-03-22 15:50 GMT+01:00, velocit...@gmail.com :
>> From: Nick Renieris 
>>
>> Option "-page N" (page index N starts from 1) can now
>> be used to specify which TIFF page/subfile to decode.
>
> What is the current behaviour?
> Shouldn't the decoder output all pages as for a video file?

How?

>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel 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".