Re: [FFmpeg-devel] [PATCH v2] lavf/mxfdec: demux s436m as eia608 subtitle track

2018-07-05 Thread Michael Niedermayer
On Wed, Jul 04, 2018 at 03:05:58PM -0700, Baptiste Coudurier wrote:
> ---
>  libavformat/mxfdec.c | 103 +++
>  1 file changed, 103 insertions(+)

This crashes with

./ffmpeg -i /home/michael/tickets//4256/invalid_pointer.mxf

https://trac.ffmpeg.org/raw-attachment/ticket/4256/invalid_pointer.mxf


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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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


Re: [FFmpeg-devel] [PATCH]configure: toolchain-tsan does not need -fPIE

2018-07-05 Thread Carl Eugen Hoyos
2018-07-03 22:20 GMT+02:00, Carl Eugen Hoyos :

> Attached patch fixes compilation for some combinations of kernel and
> gcc, I tested that neither gcc-tsan nor clang-tsan need -fPIE.

Patch applied.

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


Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_qsv: fix log level for session initialization error

2018-07-05 Thread Moritz Barsnick
On Thu, Jul 05, 2018 at 16:17:45 +0200, Maxym Dmytrychenko wrote:
> just looking at the initial issue on Windows:
> >I thought I had the entire pipeline (decode/scale-resize/encode) being
> performed by Quicksync
> it is not yet clear if exactly so and logs have to be checked,
> like CPU utilization can be high due to decode, as an example.

That may be the case, I don't know, you know much better. It's the
general question:

> do you really want to have warning log with the error statement inside?
> (root case of such MFXVideoVPP_Init behaviour is different topic and
> actually should be re-checked)

It's just that I was under the impression that a non-fatal "error"
which changes the behavior was not being clearly reported. If it
doesn't change behavior, or this change is of no importance to the
user, then it can stay as is. If a message helps to resolve issues, it
should be as informative as possible.

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


Re: [FFmpeg-devel] [PATCH 07/12] ratecontrol: fix stuffing bits for 30000/1001 fps one frame vbv

2018-07-05 Thread Michael Niedermayer
On Thu, Jul 05, 2018 at 11:49:19PM +0200, Michael Niedermayer wrote:
> On Thu, Jul 05, 2018 at 08:23:24AM -0700, Baptiste Coudurier wrote:
> > Hi Michael
> > 
> > On Thu, Jul 5, 2018 at 3:43 AM, Michael Niedermayer 
> > wrote:
> > 
> > > On Wed, Jul 04, 2018 at 11:35:09AM -0700, Baptiste Coudurier wrote:
> > > > ---
> > > >  libavcodec/ratecontrol.c | 12 ++--
> > > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
> > > > index 49d169ba25..28bdddbad1 100644
> > > > --- a/libavcodec/ratecontrol.c
> > > > +++ b/libavcodec/ratecontrol.c
> > > > @@ -705,16 +705,16 @@ int ff_vbv_update(MpegEncContext *s, int
> > > frame_size)
> > > >  rcc->buffer_index += av_clip(left, min_rate, max_rate);
> > > >
> > > >  if (rcc->buffer_index > buffer_size) {
> > > > -int stuffing = ceil((rcc->buffer_index - buffer_size) / 8);
> > > > +int stuffing = rcc->buffer_index - buffer_size;
> > > >
> > > > -if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)
> > > > -stuffing = 4;
> > > > -rcc->buffer_index -= 8 * stuffing;
> > > > +if (stuffing < 32 && s->codec_id == AV_CODEC_ID_MPEG4)
> > > > +stuffing = 32;
> > > > +rcc->buffer_index -= stuffing;
> > > >
> > > >  if (s->avctx->debug & FF_DEBUG_RC)
> > > > -av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n",
> > > stuffing);
> > > > +av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n",
> > > stuffing>>3);
> > > >
> > > > -return stuffing;
> > > > +return stuffing>>3;
> > > >  }
> > >
> > > This would break VBV for most codecs
> > > buffer_index is a double, the if() condition is triggered if the current
> > > frame
> > > is too small. All the rounding has to be up as in the ceil() that was
> > > there.
> > > The stuffing that is added, is minimal, so a decrease would be expected to
> > > break cases occasionally
> > >
> > > Can you explain how this code fails, in what exact case
> > > (max/min rate/ buffer_size/fps) ?
> > >
> > 
> > Basically It doesn't work for IMX50, requiring exact frame size of 208541
> > bytes at 3/1001 fps
> > and vbv delay of 3003
> 
> Is exactly 208541 required or is it "up to 208541"? Tim said in
> https://ffmpeg.org/pipermail/ffmpeg-user/2015-June/026872.html
> that its "up to"
> 
> up to should be easy achievable by adjusting the bitrates and vbv buffer
> size to values consistent and below 208541. This would then result in a
> mix of 208541 and 208540 bytes. (always 208541 does not result in a integer
> bitrate so its tricky to specify and also due to float use could then still
> be somewhat unreliable
> (208541 bytes and 3/1001 fps result in a bitrate of 
> 4840.159840159840159840159840...)
> 
> iam not sure if theres a combination of parameters to achieve always 208541
> currently.
> If not it may be an option to add a parameter to force a specific frame size
> directly to the ratecontrol code.

After looking a bit, you can achive 208541 with
-vcodec mpeg2video   -minrate 4841 -maxrate 4841 -b:v 4841 -bufsize 
1668329  -rc_init_occupancy 1668329-f image2 -an  delthisimg%d.mpeg2

not sure if this has issues but it seems to consistently produce the intended
frame size

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH 07/12] ratecontrol: fix stuffing bits for 30000/1001 fps one frame vbv

2018-07-05 Thread Michael Niedermayer
On Thu, Jul 05, 2018 at 08:23:24AM -0700, Baptiste Coudurier wrote:
> Hi Michael
> 
> On Thu, Jul 5, 2018 at 3:43 AM, Michael Niedermayer 
> wrote:
> 
> > On Wed, Jul 04, 2018 at 11:35:09AM -0700, Baptiste Coudurier wrote:
> > > ---
> > >  libavcodec/ratecontrol.c | 12 ++--
> > >  1 file changed, 6 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
> > > index 49d169ba25..28bdddbad1 100644
> > > --- a/libavcodec/ratecontrol.c
> > > +++ b/libavcodec/ratecontrol.c
> > > @@ -705,16 +705,16 @@ int ff_vbv_update(MpegEncContext *s, int
> > frame_size)
> > >  rcc->buffer_index += av_clip(left, min_rate, max_rate);
> > >
> > >  if (rcc->buffer_index > buffer_size) {
> > > -int stuffing = ceil((rcc->buffer_index - buffer_size) / 8);
> > > +int stuffing = rcc->buffer_index - buffer_size;
> > >
> > > -if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)
> > > -stuffing = 4;
> > > -rcc->buffer_index -= 8 * stuffing;
> > > +if (stuffing < 32 && s->codec_id == AV_CODEC_ID_MPEG4)
> > > +stuffing = 32;
> > > +rcc->buffer_index -= stuffing;
> > >
> > >  if (s->avctx->debug & FF_DEBUG_RC)
> > > -av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n",
> > stuffing);
> > > +av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n",
> > stuffing>>3);
> > >
> > > -return stuffing;
> > > +return stuffing>>3;
> > >  }
> >
> > This would break VBV for most codecs
> > buffer_index is a double, the if() condition is triggered if the current
> > frame
> > is too small. All the rounding has to be up as in the ceil() that was
> > there.
> > The stuffing that is added, is minimal, so a decrease would be expected to
> > break cases occasionally
> >
> > Can you explain how this code fails, in what exact case
> > (max/min rate/ buffer_size/fps) ?
> >
> 
> Basically It doesn't work for IMX50, requiring exact frame size of 208541
> bytes at 3/1001 fps
> and vbv delay of 3003

Is exactly 208541 required or is it "up to 208541"? Tim said in
https://ffmpeg.org/pipermail/ffmpeg-user/2015-June/026872.html
that its "up to"

up to should be easy achievable by adjusting the bitrates and vbv buffer
size to values consistent and below 208541. This would then result in a
mix of 208541 and 208540 bytes. (always 208541 does not result in a integer
bitrate so its tricky to specify and also due to float use could then still
be somewhat unreliable
(208541 bytes and 3/1001 fps result in a bitrate of 
4840.159840159840159840159840...)

iam not sure if theres a combination of parameters to achieve always 208541
currently.
If not it may be an option to add a parameter to force a specific frame size
directly to the ratecontrol code.

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

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


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


Re: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] optimize vp8 decoding in vp8dsp.

2018-07-05 Thread Michael Niedermayer
On Thu, Jul 05, 2018 at 08:02:01PM +0800, yinshiyou...@loongson.cn wrote:
> 
> Is there anyone reviewing my patch? I sent 9 patchs about 20 days ago, but 
> only one patch received reply at June 14. 

Theres a maintainer listed for mips in MAINTAINERs
he should review the patches. If he has no time then someone else should
maybe help him
Also it may make sense to split maintainership of the 2 MIPS implementations
if that would make reviews work better but it still requires someone to do
the review.

I dont know mips asm well enough to do a optimal review

thanks

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-05 Thread Aman Gupta
On Wed, Jul 4, 2018 at 3:05 AM Thomas Guillem  wrote:

> On macOS, a zero rc_max_rate cause an error from
> VTSessionSetProperty(kVTCompressionPropertyKey_DataRateLimits).
>
> on iOS (depending on device/version), a zero rc_max_rate cause invalid
> arguments from the vtenc_output_callback after few frames and then a crash
> within the VideoToolbox library.
> ---
>  libavcodec/videotoolboxenc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index ac847358ab..aa9aae7e05 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -1019,6 +1019,7 @@ static int vtenc_create_encoder(AVCodecContext
>  *avctx,
>
>  if (vtctx->codec_id == AV_CODEC_ID_H264) {
>  // kVTCompressionPropertyKey_DataRateLimits is not available for
> HEVC
> +if (max_rate > 0) {


I think it would be better to add this condition to the existing if block
above so we can avoid another level of indentation.

Patch looks fine to me otherwise. I can make this change and commit this
week.

Aman


>  bytes_per_second_value = max_rate >> 3;
>  bytes_per_second = CFNumberCreate(kCFAllocatorDefault,
>kCFNumberSInt64Type,
> @@ -1058,6 +1059,7 @@ static int vtenc_create_encoder(AVCodecContext
>  *avctx,
>  av_log(avctx, AV_LOG_ERROR, "Error setting max bitrate
> property: %d\n", status);
>  return AVERROR_EXTERNAL;
>  }
> +}
>
>  if (profile_level) {
>  status = VTSessionSetProperty(vtctx->session,
> --
> 2.18.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [GSoC] FFserver: Add HLS and DASH

2018-07-05 Thread Stephan Holljes
On Thu, Jun 28, 2018 at 2:51 AM, Stephan Holljes
 wrote:
> This patchset took embarrassingly long to produce. I first took a few wrong
> turns, but I think I'm now at a point where I reached the limits of the
> public server API in libavformat. The main problem is that I cannot set
> options on clients that are accepted through http_accept(), for example
> a timeout on socket operations, as currently a client that disconnects while
> being sent a file causes the sending thread to loop infintely in a 
> poll()-call.
> I wonder if adding a different library handling the http server (as planned 
> for
> the future) would be better done now rather than later.
>
> Another bug I cannot really explain so far (that may be because of my
> unfamiliarity with DASH) is that with longer files the DASH stream starts to
> repeat some fragments (at least in mpv) in weird ways. HLS does not have this
> problem.
>
> Another thing that is not yet handled are unmuxable codecs.
>
> The patchset also includes some cleanup and other various fixes.
>
>

Ping, since I sent this email I've been working on adding
libmicrohttpd to replace lavformat's http-server.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 07/12] ratecontrol: fix stuffing bits for 30000/1001 fps one frame vbv

2018-07-05 Thread Baptiste Coudurier
Hi Michael

On Thu, Jul 5, 2018 at 3:43 AM, Michael Niedermayer 
wrote:

> On Wed, Jul 04, 2018 at 11:35:09AM -0700, Baptiste Coudurier wrote:
> > ---
> >  libavcodec/ratecontrol.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
> > index 49d169ba25..28bdddbad1 100644
> > --- a/libavcodec/ratecontrol.c
> > +++ b/libavcodec/ratecontrol.c
> > @@ -705,16 +705,16 @@ int ff_vbv_update(MpegEncContext *s, int
> frame_size)
> >  rcc->buffer_index += av_clip(left, min_rate, max_rate);
> >
> >  if (rcc->buffer_index > buffer_size) {
> > -int stuffing = ceil((rcc->buffer_index - buffer_size) / 8);
> > +int stuffing = rcc->buffer_index - buffer_size;
> >
> > -if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)
> > -stuffing = 4;
> > -rcc->buffer_index -= 8 * stuffing;
> > +if (stuffing < 32 && s->codec_id == AV_CODEC_ID_MPEG4)
> > +stuffing = 32;
> > +rcc->buffer_index -= stuffing;
> >
> >  if (s->avctx->debug & FF_DEBUG_RC)
> > -av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n",
> stuffing);
> > +av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n",
> stuffing>>3);
> >
> > -return stuffing;
> > +return stuffing>>3;
> >  }
>
> This would break VBV for most codecs
> buffer_index is a double, the if() condition is triggered if the current
> frame
> is too small. All the rounding has to be up as in the ceil() that was
> there.
> The stuffing that is added, is minimal, so a decrease would be expected to
> break cases occasionally
>
> Can you explain how this code fails, in what exact case
> (max/min rate/ buffer_size/fps) ?
>

Basically It doesn't work for IMX50, requiring exact frame size of 208541
bytes at 3/1001 fps
and vbv delay of 3003

-- 
Baptiste Coudurier
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_qsv: fix log level for session initialization error

2018-07-05 Thread Maxym Dmytrychenko
do you really want to have warning log with the error statement inside?
(root case of such MFXVideoVPP_Init behaviour is different topic and
actually should be re-checked)

just looking at the initial issue on Windows:
>I thought I had the entire pipeline (decode/scale-resize/encode) being
performed by Quicksync
it is not yet clear if exactly so and logs have to be checked,
like CPU utilization can be high due to decode, as an example.

Command line can be easier, if input codec format is supported by qsv,
something like:
ffmpeg.exe -hwaccel qsv  -c:v h264_qsv -i "testvid.mp4" -vf
"scale_qsv=640:360" -b:v 800k -c:v h264_qsv -c:a copy -y "testoutput.mp4"

regards
Maxym

On Thu, Jul 5, 2018 at 3:20 PM Moritz Barsnick  wrote:

> On Thu, Jul 05, 2018 at 10:17:35 +, Li, Zhong wrote:
> > > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Moritz Barsnick
> [...]
> > > Ideally, the returned mfxStatus would be evaluated and printed, but no
> such
> > > function is available (yet). %d perhaps?
> >
> > ff_qsv_print_error() can be used to print detailed error type. Is it
> helpful?
>
> Basically yes, even in other places, but that function's in libavcodec,
> and we're in libavutil. We would need to move the code around IIUC, but
> I don't have any way of testing new code with this failing scenario
> right now (I have this effect on a Windows machine, but can't actually
> build on Windows), so that would be a blind modification from my side.
> Better if the QSV maintainers (i.e. you ;-)) did this.
>
> This is the issue it would help to understand:
> http://ffmpeg.org/pipermail/ffmpeg-user/2018-July/040438.html
>
> Thanks,
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc/filters: add documentation to all existing OpenCL filters, except tonemap filter

2018-07-05 Thread Danil Iashchenko
add documentation to all existing OpenCL filters
---
>I like this patch, the other thing, is it have any plan to update
>openCL part like VAAPI (https://trac.ffmpeg.org/wiki/Hardware/VAAPI)
>in https://trac.ffmpeg.org/wiki/HWAccelIntro, thanks.
I am going to add it during the next week, thanks!

>Why not for tonemap_opencl?
Added.

>Since these filters are distinct, please list options as well, since their 
>software counterparts could conceivably change. Option entries should include 
>default value, range, and semantic.
Fixed.

>Why are all examples of filters, that operate upon a single stream, shown 
>within -filter_complex? '-vf' is preferred.
Fixed.

>P.S. Once this new section is created, program_opencl entry should be shifted 
>there, in a separate patch.
Shifted to opencl section.

Thanks, Danil.

 doc/filters.texi | 741 +--
 1 file changed, 611 insertions(+), 130 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index fb5f3ee..16a350a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -12917,136 +12917,6 @@ Set value which will be multiplied with filtered 
result.
 Set value which will be added to filtered result.
 @end table
 
-@anchor{program_opencl}
-@section program_opencl
-
-Filter video using an OpenCL program.
-
-@table @option
-
-@item source
-OpenCL program source file.
-
-@item kernel
-Kernel name in program.
-
-@item inputs
-Number of inputs to the filter.  Defaults to 1.
-
-@item size, s
-Size of output frames.  Defaults to the same as the first input.
-
-@end table
-
-The program source file must contain a kernel function with the given name,
-which will be run once for each plane of the output.  Each run on a plane
-gets enqueued as a separate 2D global NDRange with one work-item for each
-pixel to be generated.  The global ID offset for each work-item is therefore
-the coordinates of a pixel in the destination image.
-
-The kernel function needs to take the following arguments:
-@itemize
-@item
-Destination image, @var{__write_only image2d_t}.
-
-This image will become the output; the kernel should write all of it.
-@item
-Frame index, @var{unsigned int}.
-
-This is a counter starting from zero and increasing by one for each frame.
-@item
-Source images, @var{__read_only image2d_t}.
-
-These are the most recent images on each input.  The kernel may read from
-them to generate the output, but they can't be written to.
-@end itemize
-
-Example programs:
-
-@itemize
-@item
-Copy the input to the output (output must be the same size as the input).
-@verbatim
-__kernel void copy(__write_only image2d_t destination,
-   unsigned int index,
-   __read_only  image2d_t source)
-{
-const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
-
-int2 location = (int2)(get_global_id(0), get_global_id(1));
-
-float4 value = read_imagef(source, sampler, location);
-
-write_imagef(destination, location, value);
-}
-@end verbatim
-
-@item
-Apply a simple transformation, rotating the input by an amount increasing
-with the index counter.  Pixel values are linearly interpolated by the
-sampler, and the output need not have the same dimensions as the input.
-@verbatim
-__kernel void rotate_image(__write_only image2d_t dst,
-   unsigned int index,
-   __read_only  image2d_t src)
-{
-const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
-   CLK_FILTER_LINEAR);
-
-float angle = (float)index / 100.0f;
-
-float2 dst_dim = convert_float2(get_image_dim(dst));
-float2 src_dim = convert_float2(get_image_dim(src));
-
-float2 dst_cen = dst_dim / 2.0f;
-float2 src_cen = src_dim / 2.0f;
-
-int2   dst_loc = (int2)(get_global_id(0), get_global_id(1));
-
-float2 dst_pos = convert_float2(dst_loc) - dst_cen;
-float2 src_pos = {
-cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
-sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
-};
-src_pos = src_pos * src_dim / dst_dim;
-
-float2 src_loc = src_pos + src_cen;
-
-if (src_loc.x < 0.0f  || src_loc.y < 0.0f ||
-src_loc.x > src_dim.x || src_loc.y > src_dim.y)
-write_imagef(dst, dst_loc, 0.5f);
-else
-write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
-}
-@end verbatim
-
-@item
-Blend two inputs together, with the amount of each input used varying
-with the index counter.
-@verbatim
-__kernel void blend_images(__write_only image2d_t dst,
-   unsigned int index,
-   __read_only  image2d_t src1,
-   __read_only  image2d_t src2)
-{
-const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
-   CLK_FILTER_LINEAR);
-
-float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
-
-int2  dst_loc = (int2)(get_global_id(0), get_global_id(1));
-int2 src1_loc = dst_loc * 

Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_qsv: fix log level for session initialization error

2018-07-05 Thread Moritz Barsnick
On Thu, Jul 05, 2018 at 10:17:35 +, Li, Zhong wrote:
> > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
> > Moritz Barsnick
[...]
> > Ideally, the returned mfxStatus would be evaluated and printed, but no such
> > function is available (yet). %d perhaps?
> 
> ff_qsv_print_error() can be used to print detailed error type. Is it helpful?

Basically yes, even in other places, but that function's in libavcodec,
and we're in libavutil. We would need to move the code around IIUC, but
I don't have any way of testing new code with this failing scenario
right now (I have this effect on a Windows machine, but can't actually
build on Windows), so that would be a blind modification from my side.
Better if the QSV maintainers (i.e. you ;-)) did this.

This is the issue it would help to understand:
http://ffmpeg.org/pipermail/ffmpeg-user/2018-July/040438.html

Thanks,
Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/mips: [loongson] optimize vp8 decoding in vp8dsp.

2018-07-05 Thread yinshiyou-hf

Is there anyone reviewing my patch? I sent 9 patchs about 20 days ago, but only 
one patch received reply at June 14. 


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


Re: [FFmpeg-devel] [PATCH 4/6] avformat/rmdec: Do not pass mime type in rm_read_multi() to ff_rm_read_mdpr_codecdata()

2018-07-05 Thread Michael Niedermayer
On Tue, Jul 03, 2018 at 11:05:28PM +0200, Michael Niedermayer wrote:
> Fixes: use after free()
> Fixes: rmdec-crash-ffe85b4cab1597d1cfea6955705e53f1f5c8a362
> 
> Found-by: Paul Ch 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/rmdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

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


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


Re: [FFmpeg-devel] [PATCH 3/6] avformat/asfdec_o: Check size_bmp more fully

2018-07-05 Thread Michael Niedermayer
On Tue, Jul 03, 2018 at 11:05:27PM +0200, Michael Niedermayer wrote:
> Fixes: integer overflow and out of array access
> Fixes: asfo-crash-46080c4341572a7137a162331af77f6ded45cbd7
> 
> Found-by: Paul Ch 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/asfdec_o.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

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


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


Re: [FFmpeg-devel] [PATCH 2/6] avformat/mxfdec: Fix av_log context

2018-07-05 Thread Michael Niedermayer
On Tue, Jul 03, 2018 at 11:12:21PM +0200, Tomas Härdin wrote:
> tis 2018-07-03 klockan 23:05 +0200 skrev Michael Niedermayer:
> > Fixes: out of array access
> > Fixes: mxf-crash-1c2e59bf07a34675bfb3ada5e1ec22fa9f38f923
> > 
> > > Found-by: Paul Ch 
> > > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/mxfdec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > index 8c417aea26..7c6d7c07c9 100644
> > --- a/libavformat/mxfdec.c
> > +++ b/libavformat/mxfdec.c
> > @@ -2146,7 +2146,7 @@ static int mxf_parse_structural_metadata(MXFContext 
> > *mxf)
> >  MXFEssenceContainerData *essence_data;
> >  
> >  if (!(essence_data = mxf_resolve_strong_ref(mxf, 
> > >essence_container_data_refs[k], EssenceContainerData))) {
> > -av_log(mxf, AV_LOG_TRACE, "could not resolve essence 
> > container data strong ref\n");
> > +av_log(mxf->fc, AV_LOG_TRACE, "could not resolve 
> > essence container data strong ref\n");
> 
> Good catch

will apply

thanks

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

There will always be a question for which you do not know the correct answer.


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


[FFmpeg-devel] [PATCH v8 2/3] lavf/riff: add avs2 fourcc

2018-07-05 Thread hwren
Signed-off-by: hwren 
---
 libavformat/riff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index 8911725..4153372 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -369,6 +369,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
 { AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
 { AV_CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') },
+{ AV_CODEC_ID_AVS2, MKTAG('A', 'V', 'S', '2') },
 { AV_CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') },
 { AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
 { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'C') },
-- 
2.7.4


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


[FFmpeg-devel] [PATCH v8 3/3] lavc, doc, configure: add avs2 video decoder wrapper

2018-07-05 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 ++
 doc/decoders.texi  |   6 ++
 doc/general.texi   |  14 
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libdavs2.c  | 177 +
 7 files changed, 204 insertions(+)
 create mode 100644 libavcodec/libdavs2.c

diff --git a/Changelog b/Changelog
index d8e2811..ec65f43 100644
--- a/Changelog
+++ b/Changelog
@@ -13,6 +13,7 @@ version :
 - adeclip filter
 - libtensorflow backend for DNN based filters like srcnn
 - vc1 decoder is now bit-exact
+- AVS2 video decoder via libdavs2
 
 
 version 4.0:
diff --git a/configure b/configure
index 0e8e8a6..059812f 100755
--- a/configure
+++ b/configure
@@ -226,6 +226,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
@@ -1638,6 +1639,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 avisynth
 frei0r
 libcdio
+libdavs2
 librubberband
 libvidstab
 libx264
@@ -3048,6 +3050,7 @@ libaom_av1_encoder_deps="libaom"
 libcelt_decoder_deps="libcelt"
 libcodec2_decoder_deps="libcodec2"
 libcodec2_encoder_deps="libcodec2"
+libdavs2_decoder_deps="libdavs2"
 libfdk_aac_decoder_deps="libfdk_aac"
 libfdk_aac_encoder_deps="libfdk_aac"
 libfdk_aac_encoder_select="audio_frame_queue"
@@ -6001,6 +6004,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
+enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.4.95" 
davs2.h davs2_decoder_open
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
 enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen ||
diff --git a/doc/decoders.texi b/doc/decoders.texi
index 8f07bc1..9439b7b 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -47,6 +47,12 @@ top-field-first is assumed
 
 @end table
 
+@section libdavs2
+
+AVS2/IEEE 1857.4 video decoder wrapper.
+
+This decoder allows libavcodec to decode AVS2 streams with davs2 library.
+
 @c man end VIDEO DECODERS
 
 @chapter Audio Decoders
diff --git a/doc/general.texi b/doc/general.texi
index 8c3a04b..cd725bb 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -17,6 +17,20 @@ for more formats. None of them are used by default, their 
use has to be
 explicitly requested by passing the appropriate flags to
 @command{./configure}.
 
+@section libdavs2
+
+FFmpeg can make use of the davs2 library for AVS2/IEEE 1857.4 video decoding.
+
+Go to @url{https://github.com/pkuvcl/davs2} and follow the instructions for
+installing the library. Then pass @code{--enable-libdavs2} to configure to
+enable it.
+
+@float NOTE
+libdavs2 is under the GNU Public License Version 2 or later
+(see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for
+details), you must upgrade FFmpeg's license to GPL in order to use it.
+@end float
+
 @section Alliance for Open Media libaom
 
 FFmpeg can make use of the libaom library for AV1 decoding.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6b6d6de..5135b97 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -944,6 +944,7 @@ OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
 OBJS-$(CONFIG_LIBCODEC2_DECODER)  += libcodec2.o codec2utils.o
 OBJS-$(CONFIG_LIBCODEC2_ENCODER)  += libcodec2.o codec2utils.o
+OBJS-$(CONFIG_LIBDAVS2_DECODER)   += libdavs2.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
 OBJS-$(CONFIG_LIBGSM_DECODER) += libgsmdec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 90d170b..a59b601 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -667,6 +667,7 @@ extern AVCodec ff_libaom_av1_encoder;
 extern AVCodec ff_libcelt_decoder;
 extern AVCodec ff_libcodec2_encoder;
 extern AVCodec ff_libcodec2_decoder;
+extern AVCodec ff_libdavs2_decoder;
 extern AVCodec ff_libfdk_aac_encoder;
 extern AVCodec ff_libfdk_aac_decoder;
 extern AVCodec ff_libgsm_encoder;
diff --git a/libavcodec/libdavs2.c 

[FFmpeg-devel] [PATCH v8 1/3] lavc: add avs2 parser

2018-07-05 Thread hwren
Signed-off-by: hwren 
---
 libavcodec/Makefile  |  1 +
 libavcodec/avcodec.h |  1 +
 libavcodec/avs2_parser.c | 95 
 libavcodec/codec_desc.c  |  7 
 libavcodec/parser.c  |  1 +
 libavcodec/version.h |  4 +-
 6 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/avs2_parser.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3ab071a..6b6d6de 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -994,6 +994,7 @@ OBJS-$(CONFIG_AAC_PARSER)  += aac_parser.o 
aac_ac3_parser.o \
   mpeg4audio.o
 OBJS-$(CONFIG_AC3_PARSER)  += ac3tab.o aac_ac3_parser.o
 OBJS-$(CONFIG_ADX_PARSER)  += adx_parser.o adx.o
+OBJS-$(CONFIG_AVS2_PARSER) += avs2_parser.o
 OBJS-$(CONFIG_BMP_PARSER)  += bmp_parser.o
 OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o
 OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c90166d..1ac9092 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -409,6 +409,7 @@ enum AVCodecID {
 AV_CODEC_ID_DXV,
 AV_CODEC_ID_SCREENPRESSO,
 AV_CODEC_ID_RSCC,
+AV_CODEC_ID_AVS2,
 
 AV_CODEC_ID_Y41P = 0x8000,
 AV_CODEC_ID_AVRP,
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
new file mode 100644
index 000..163b297
--- /dev/null
+++ b/libavcodec/avs2_parser.c
@@ -0,0 +1,95 @@
+/*
+ * AVS2/IEEE 1857.4 video parser.
+ * Copyright (c) 2018  Huiwen Ren 
+ *
+ * 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 "parser.h"
+
+#define SLICE_MAX_START_CODE0x01af
+
+#define ISPIC(x)  ((x) == 0xB3 || (x) == 0xB6)
+#define ISUNIT(x) ((x) == 0xB0 || (x) == 0xB1 || (x) == 0xB2 || ISPIC(x))
+
+static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int 
buf_size) 
+{
+int pic_found  = pc->frame_start_found;
+uint32_t state = pc->state;
+int cur = 0;
+
+if (!pic_found) {
+for (; cur < buf_size; ++cur) {
+state = (state<<8) | buf[cur];
+if (ISUNIT(buf[cur])){
+++cur;
+pic_found = 1;
+break;
+}
+}
+}
+
+if (pic_found) {
+if (!buf_size)
+return END_NOT_FOUND;
+for (; cur < buf_size; ++cur) {
+state = (state << 8) | buf[cur];
+if ((state & 0xFF00) == 0x100 && state > SLICE_MAX_START_CODE) 
{
+pc->frame_start_found = 0;
+pc->state = -1;
+return cur - 3;
+}
+}
+}
+
+pc->frame_start_found = pic_found;
+pc->state = state;
+
+return END_NOT_FOUND;
+}
+
+static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
+  const uint8_t **poutbuf, int *poutbuf_size,
+  const uint8_t *buf, int buf_size)
+{
+ParseContext *pc = s->priv_data;
+int next;
+
+if (s->flags & PARSER_FLAG_COMPLETE_FRAMES)  {
+next = buf_size;
+} else {
+next = avs2_find_frame_end(pc, buf, buf_size);
+if (ff_combine_frame(pc, next, , _size) < 0) {
+*poutbuf = NULL;
+*poutbuf_size = 0;
+return buf_size;
+}
+}
+
+*poutbuf = buf;
+*poutbuf_size = buf_size;
+
+return next;
+}
+
+AVCodecParser ff_avs2_parser = {
+.codec_ids  = { AV_CODEC_ID_AVS2 },
+.priv_data_size = sizeof(ParseContext),
+.parser_parse   = avs2_parse,
+.parser_close   = ff_parse_close,
+.split  = ff_mpeg4video_split,
+};
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 36e9a9b..c0ed4d4 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1395,6 +1395,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .props = AV_CODEC_PROP_LOSSLESS,
 },
 {
+.id= AV_CODEC_ID_AVS2,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "avs2",
+.long_name = NULL_IF_CONFIG_SMALL("AVS2/IEEE 1857.4"),
+.props = AV_CODEC_PROP_LOSSY,
+},
+{
 .id= AV_CODEC_ID_Y41P,
 .type  = 

Re: [FFmpeg-devel] [PATCH 07/12] ratecontrol: fix stuffing bits for 30000/1001 fps one frame vbv

2018-07-05 Thread Michael Niedermayer
On Wed, Jul 04, 2018 at 11:35:09AM -0700, Baptiste Coudurier wrote:
> ---
>  libavcodec/ratecontrol.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
> index 49d169ba25..28bdddbad1 100644
> --- a/libavcodec/ratecontrol.c
> +++ b/libavcodec/ratecontrol.c
> @@ -705,16 +705,16 @@ int ff_vbv_update(MpegEncContext *s, int frame_size)
>  rcc->buffer_index += av_clip(left, min_rate, max_rate);
>  
>  if (rcc->buffer_index > buffer_size) {
> -int stuffing = ceil((rcc->buffer_index - buffer_size) / 8);
> +int stuffing = rcc->buffer_index - buffer_size;
>  
> -if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)
> -stuffing = 4;
> -rcc->buffer_index -= 8 * stuffing;
> +if (stuffing < 32 && s->codec_id == AV_CODEC_ID_MPEG4)
> +stuffing = 32;
> +rcc->buffer_index -= stuffing;
>  
>  if (s->avctx->debug & FF_DEBUG_RC)
> -av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n", 
> stuffing);
> +av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n", 
> stuffing>>3);
>  
> -return stuffing;
> +return stuffing>>3;
>  }

This would break VBV for most codecs
buffer_index is a double, the if() condition is triggered if the current frame
is too small. All the rounding has to be up as in the ceil() that was there.
The stuffing that is added, is minimal, so a decrease would be expected to
break cases occasionally

Can you explain how this code fails, in what exact case 
(max/min rate/ buffer_size/fps) ?

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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


Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_qsv: fix log level for session initialization error

2018-07-05 Thread Li, Zhong
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Moritz Barsnick
> Sent: Wednesday, July 4, 2018 10:25 PM
> To: FFmpeg development discussions and patches
> 
> Subject: [FFmpeg-devel] [PATCH] avutil/hwcontext_qsv: fix log level for
> session initialization error
> 
> While the error is not fatal, the message should not be displayed only in
> verbose logging, as its consequences are of interest.
> 
> Also fix message formatting (missing space).
> 
> Signed-off-by: Moritz Barsnick 
> ---
> 
> Ideally, the returned mfxStatus would be evaluated and printed, but no such
> function is available (yet). %d perhaps?

ff_qsv_print_error() can be used to print detailed error type. Is it helpful?

> 
>  libavutil/hwcontext_qsv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index
> 250091c4e8..e7ffb42f37 100644
> --- a/libavutil/hwcontext_qsv.c
> +++ b/libavutil/hwcontext_qsv.c
> @@ -474,7 +474,7 @@ static int
> qsv_init_internal_session(AVHWFramesContext *ctx,
> 
>  err = MFXVideoVPP_Init(*session, );
>  if (err != MFX_ERR_NONE) {
> -av_log(ctx, AV_LOG_VERBOSE, "Error opening the internal VPP
> session."
> +av_log(ctx, AV_LOG_WARNING, "Error opening the internal VPP
> session. "
> "Surface upload/download will not be possible\n");
>  MFXClose(*session);
>  *session = NULL;
> --
> 2.14.4

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


[FFmpeg-devel] [PATCH] avfilter/setpts: add FR shorthand for FRAME_RATE

2018-07-05 Thread Gyan Doshi
From 5012a823d34cecaac2bc19ef60062e6eedcdda6e Mon Sep 17 00:00:00 2001
From: Gyan Doshi 
Date: Thu, 5 Jul 2018 15:24:55 +0530
Subject: [PATCH] avfilter/setpts: add FR shorthand for FRAME_RATE

---
 doc/filters.texi | 2 +-
 libavfilter/setpts.c | 5 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index fb5f3eef4b..b697a829c4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19387,7 +19387,7 @@ The expression is evaluated through the eval API and 
can contain the following
 constants:
 
 @table @option
-@item FRAME_RATE
+@item FRAME_RATE, FR
 frame rate, only defined for constant frame-rate video
 
 @item PTS
diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c
index 4505498bf3..800ba6a83f 100644
--- a/libavfilter/setpts.c
+++ b/libavfilter/setpts.c
@@ -57,6 +57,7 @@ static const char *const var_names[] = {
 "RTCSTART",///< wallclock (RTC) time at the start of the movie in 
micro seconds
 "S",   //   Number of samples in the current frame
 "SR",  //   Audio sample rate
+"FR",  ///< defined only for constant frame-rate video
 NULL
 };
 
@@ -81,6 +82,7 @@ enum var_name {
 VAR_RTCSTART,
 VAR_S,
 VAR_SR,
+VAR_FR,
 VAR_VARS_NB
 };
 
@@ -127,7 +129,8 @@ static int config_input(AVFilterLink *inlink)
 setpts->var_values[VAR_SAMPLE_RATE] =
 setpts->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
 
-setpts->var_values[VAR_FRAME_RATE] = inlink->frame_rate.num &&
+setpts->var_values[VAR_FRAME_RATE] =
+setpts->var_values[VAR_FR] = inlink->frame_rate.num &&
  inlink->frame_rate.den ?
 av_q2d(inlink->frame_rate) : NAN;
 
-- 
2.12.2.windows.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel