Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread wm4
On Thu, 3 Dec 2015 08:26:21 +0100
Nicolas George  wrote:

> Le tridi 13 frimaire, an CCXXIV, Ganesh Ajjanagadde a écrit :
> > There was no reason AFAIK for making AV_CRC_24_IEEE 12.  
> 
> The reason was to leave room for the fork to add its own new constants
> without causing ABI incompatibilities.
> 
> Regards,
> 

You could just append them to the end, like all new constants.

But someone preferred to make life harder and worse for everyone by
trying to keep the FFmpeg ABI somewhat compatible to Libav (and now we
have useless accessors for public fields etc.).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread Nicolas George
Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> You could just append them to the end, like all new constants.

That does not prevent ABI incompatibilities.

> But someone preferred to make life harder and worse for everyone by
> trying to keep the FFmpeg ABI somewhat compatible to Libav

Please refrain from disparaging other people's work when they do not have
the same goals as you.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread wm4
On Thu, 3 Dec 2015 09:17:22 +0100
Nicolas George  wrote:

> Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> > You could just append them to the end, like all new constants.  
> 
> That does not prevent ABI incompatibilities.

It removes the need for such hacks.

> > But someone preferred to make life harder and worse for everyone by
> > trying to keep the FFmpeg ABI somewhat compatible to Libav  
> 
> Please refrain from disparaging other people's work when they do not have
> the same goals as you.

So the goal is not to make it simple to write application code in a way
that will be ABI compatible with newer FFmpeg minor releases?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread Clément Bœsch
On Thu, Dec 03, 2015 at 10:08:50AM +0100, wm4 wrote:
> On Thu, 3 Dec 2015 09:17:22 +0100
> Nicolas George  wrote:
> 
> > Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> > > You could just append them to the end, like all new constants.  
> > 
> > That does not prevent ABI incompatibilities.
> 
> It removes the need for such hacks.
> 
> > > But someone preferred to make life harder and worse for everyone by
> > > trying to keep the FFmpeg ABI somewhat compatible to Libav  
> > 
> > Please refrain from disparaging other people's work when they do not have
> > the same goals as you.
> 
> So the goal is not to make it simple to write application code in a way
> that will be ABI compatible with newer FFmpeg minor releases?

I think Nicolas was just initially saying that the padding added was meant
to preserve ABI compatibility when it was something we cared about.
Apparently, we agreed to stop this (not sure if everyone agreed but we
did). So while that hack doesn't matter anymore, the point was that it was
not meaningless; it was just a clarification.

Can we move on to something else?

-- 
Clément B.


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


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread Nicolas George
Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> So the goal is not to make it simple to write application code in a way
> that will be ABI compatible with newer FFmpeg minor releases?

Stop being a caricature.

The goal was to be ABI-compatible with the fork. Considering the hostile
stance of the fork at the time, this was not an easy task, obviously, and
causes a lot of drawbacks for developers, but it also meant that users could
just drop the FFmpeg libraries in /usr/local on their Debian or Gentoo and
have them replace the system's libav libraries for the better. Convenience
for the users has always been a major goal.

It is pretty easy for you to say, in hindsight, that it was useless, but it
is also very insulting for the people who were involved in the project at
the time.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] tests/api: Fix API test build on windows with --enable-shared

2015-12-03 Thread Hendrik Leppkes
On Wed, Dec 2, 2015 at 9:09 AM, Hendrik Leppkes  wrote:
> On Wed, Dec 2, 2015 at 2:29 AM, Michael Niedermayer  wrote:
>> On Tue, Dec 01, 2015 at 08:04:22PM +0100, Hendrik Leppkes wrote:
>>> On Mon, Nov 30, 2015 at 10:50 PM, Hendrik Leppkes  
>>> wrote:
>>> > ---
>>> > I'm not quite sure if this fix is 100% correct, but it works here.
>>> >
>>> > The problem is that FF_DEP_LIBS points to the .dll files, but you can't 
>>> > link to the .dll files,
>>> > you need to point to the import libraries. Unfortunately there is no 
>>> > variable which simply
>>> > holds all import libraries - but they do appear to be part of 
>>> > FF_EXTRALIBS, so thats used instead.
>>> >
>>> > tests/api/Makefile | 2 +-
>>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>>> >
>>> > diff --git a/tests/api/Makefile b/tests/api/Makefile
>>> > index c48c34a..a6d8e42 100644
>>> > --- a/tests/api/Makefile
>>> > +++ b/tests/api/Makefile
>>> > @@ -14,7 +14,7 @@ $(APITESTOBJS) $(APITESTOBJS:.o=.i): CPPFLAGS += -DTEST
>>> >  $(APITESTOBJS) $(APITESTOBJS:.o=.i): CFLAGS += -Umain
>>> >
>>> >  $(APITESTPROGS): %$(EXESUF): %.o $(EXEOBJS) $(FF_DEP_LIBS)
>>> > -   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter %.o,$^) 
>>> > $(FF_DEP_LIBS) $(FFEXTRALIBS) $(ELIBS)
>>> > +   $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(filter %.o,$^) 
>>> > $(FF_EXTRALIBS) $(ELIBS)
>>> >
>>> >  testclean::
>>> > $(RM) $(addprefix $(APITESTSDIR)/,$(CLEANSUFFIXES) 
>>> > *-test$(EXESUF))
>>> > --
>>> > 2.6.2.windows.1
>>> >
>>>
>>> Anyone that knows the build system a bit more? Or maybe anyone that
>>
>>> just feels like testing on some other systems than mine? :)
>>
>> seems to work on everything i tried but that probably is a small
>> subset of what is out there
>>
>
> Considering this is only in the FATE Makefile, I'll push this later
> and address any fallout on FATE, if any, unless someone objects in the
> next couple hours.
>

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


[FFmpeg-devel] [PATCH] avcodec/srtdec: Keep exact end times

2015-12-03 Thread Eelco Lempsink
When converting SRT to SRT (to normalize) or WebVTT the end timestamps were
modified compared to the original.

Fixes trac 4783.

NOTE: The FATE test 'sub-srt' fails after this patch, because the end times of
the Dialogue lines change from X:XX:XX.50 to X:XX:XX.49. I can argue that this
is semantically correct, because in the original SRT the begin and end times
are such that there is no (unintended) overlap between cues, but since the
semantics of SRT are poorly defined, I’m not sure it’s correct.
---
 libavcodec/srtdec.c  | 15 ++
 tests/ref/fate/sub-webvttenc | 66 ++--
 2 files changed, 43 insertions(+), 38 deletions(-)

diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index 542dd35..54568ca 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -57,7 +57,7 @@ static int srt_decode_frame(AVCodecContext *avctx,
 {
 AVSubtitle *sub = data;
 AVBPrint buffer;
-int ts_start, ts_end, x1 = -1, y1 = -1, x2 = -1, y2 = -1;
+int ts_start, ts_duration, x1 = -1, y1 = -1, x2 = -1, y2 = -1;
 int size, ret;
 const uint8_t *p = av_packet_get_side_data(avpkt, 
AV_PKT_DATA_SUBTITLE_POSITION, &size);
 
@@ -77,12 +77,17 @@ static int srt_decode_frame(AVCodecContext *avctx,
 ts_start = av_rescale_q(avpkt->pts,
 avctx->time_base,
 (AVRational){1,100});
-ts_end   = av_rescale_q(avpkt->pts + avpkt->duration,
-avctx->time_base,
-(AVRational){1,100});
+
+// Floor the duration (for ASS output)
+ts_duration = avpkt->duration / 10;
+
+// Set an exact end display time to prevent the rounding for ASS messing 
it up
+sub->end_display_time = av_rescale_q(avpkt->duration,
+ avctx->pkt_timebase,
+ (AVRational){1,1000});
 
 srt_to_ass(avctx, &buffer, avpkt->data, x1, y1, x2, y2);
-ret = ff_ass_add_rect_bprint(sub, &buffer, ts_start, ts_end-ts_start);
+ret = ff_ass_add_rect_bprint(sub, &buffer, ts_start, ts_duration);
 av_bprint_finalize(&buffer, NULL);
 if (ret < 0)
 return ret;
diff --git a/tests/ref/fate/sub-webvttenc b/tests/ref/fate/sub-webvttenc
index dbeadb0..ba567c3 100644
--- a/tests/ref/fate/sub-webvttenc
+++ b/tests/ref/fate/sub-webvttenc
@@ -14,12 +14,12 @@ If you see this with the normal font, the player don't 
(fully) support font face
 00:04.500 --> 00:04.500
 Hidden
 
-00:04.501 --> 00:07.501
+00:04.501 --> 00:07.500
 This text should be small
 This text should be normal
 This text should be big
 
-00:07.501 --> 00:11.501
+00:07.501 --> 00:11.500
 This should be an E with an accent: È
 日本語
 This text should be bold, italics and underline
@@ -27,7 +27,7 @@ This text should be small and green
 This text should be small and red
 This text should be big and brown
 
-00:11.501 --> 00:14.501
+00:11.501 --> 00:14.500
 This line should be bold
 This line should be italics
 This line should be underline
@@ -35,7 +35,7 @@ This line should be strikethrough
 Both lines
 should be underline
 
-00:14.501 --> 00:17.501
+00:14.501 --> 00:17.500
 >
 It would be a good thing to
 hide invalid html tags that are closed and show the text in them
@@ -43,110 +43,110 @@ hide invalid html tags that are closed and show the text 
in them
 Show not opened tags
 <
 
-00:17.501 --> 00:20.501
+00:17.501 --> 00:20.500
 and also
 hide invalid html tags with parameters that are closed and show the text in 
them
 but show un-closed invalid html tags
 This text should be showed underlined without problems also: 2<3,5>1,4<6
 This shouldn't be underlined
 
-00:20.501 --> 00:21.501
+00:20.501 --> 00:21.500
 This text should be in the normal position...
 
-00:21.501 --> 00:22.501
+00:21.501 --> 00:22.500
 This text should NOT be in the normal position
 
-00:22.501 --> 00:24.501
+00:22.501 --> 00:24.500
 Implementation is the same of the ASS tag
 This text should be at the
 top and horizontally centered
 
-00:22.501 --> 00:24.501
+00:22.501 --> 00:24.500
 This text should be at the
 middle and horizontally centered
 
-00:22.501 --> 00:24.501
+00:22.501 --> 00:24.500
 This text should be at the
 bottom and horizontally centered
 
-00:24.501 --> 00:26.501
+00:24.501 --> 00:26.500
 This text should be at the
 top and horizontally at the left
 
-00:24.501 --> 00:26.501
+00:24.501 --> 00:26.500
 This text should be at the
 middle and horizontally at the left
 (The second position must be ignored)
 
-00:24.501 --> 00:26.501
+00:24.501 --> 00:26.500
 This text should be at the
 bottom and horizontally at the left
 
-00:26.501 --> 00:28.501
+00:26.501 --> 00:28.500
 This text should be at the
 top and horizontally at the right
 
-00:26.501 --> 00:28.501
+00:26.501 --> 00:28.500
 This text should be at the
 middle and horizontally at the right
 
-00:26.501 --> 00:28.501
+00:26.501 --> 00:28.500
 This text should be at the
 bottom and horizontal

Re: [FFmpeg-devel] [PATCH 2/3] lavf/utils: handle AVERROR_REDO.

2015-12-03 Thread Stefano Sabatini
On date Friday 2015-11-27 15:27:02 +0100, Clément Bœsch encoded:
> On Fri, Nov 27, 2015 at 01:10:29PM +0100, Nicolas George wrote:
> > Le septidi 7 frimaire, an CCXXIV, Clement Boesch a écrit :
> > > But then it's still exposed by the API, and someone looking at handling
> > > every error code might be wondering how to handle it.
> > 
> > « Handling every error code » seems to me like an impossible and idiotic
> > objective. What do you suggest, exactly?
> > 
> 
> I don't know; I just don't really like the idea of such error code
> "leaking" publicly in order to solve an issue internally. I don't have any
> solution, I would just loop in the demuxer or use a FFERROR (but that
> might be clumsy)

I'd like to fix the libavformat API/ffprobe, so I'm in favor of this
patchset.

Regarding the specific patch, we could keep the REDO error code (and
mark in the comment that's intended for internal use), or add and use
an internal error code.

I don't think leaking a define which is not supposed to be used by the
user is a serious problem.
-- 
FFmpeg = Fast and Formidable Multimedia Pitiless Erudite Gymnast
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] lavf/utils: handle AVERROR_REDO.

2015-12-03 Thread Nicolas George
Le tridi 13 frimaire, an CCXXIV, Stefano Sabatini a écrit :
> I'd like to fix the libavformat API/ffprobe, so I'm in favor of this
> patchset.
> 
> Regarding the specific patch, we could keep the REDO error code (and
> mark in the comment that's intended for internal use), or add and use
> an internal error code.
> 
> I don't think leaking a define which is not supposed to be used by the
> user is a serious problem.

I posted another patch series addressing the comments:

http://ffmpeg.org/pipermail/ffmpeg-devel/2015-November/184090.html

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread wm4
On Thu, 3 Dec 2015 10:19:16 +0100
Nicolas George  wrote:

> Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> > So the goal is not to make it simple to write application code in a way
> > that will be ABI compatible with newer FFmpeg minor releases?  
> 
> Stop being a caricature.
> 
> The goal was to be ABI-compatible with the fork. Considering the hostile
> stance of the fork at the time, this was not an easy task, obviously, and
> causes a lot of drawbacks for developers, but it also meant that users could
> just drop the FFmpeg libraries in /usr/local on their Debian or Gentoo and
> have them replace the system's libav libraries for the better. Convenience
> for the users has always been a major goal.

Except that nobody actually did that. It was a thing that was tried
once, went bust, but somehow it was kept.

> 
> It is pretty easy for you to say, in hindsight, that it was useless, but it
> is also very insulting for the people who were involved in the project at
> the time.

What is insulting is your behavior.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] vp9: add hwaccel hooks

2015-12-03 Thread Hendrik Leppkes
---
 libavcodec/vp9.c | 137 ---
 libavcodec/vp9.h |   3 ++
 2 files changed, 103 insertions(+), 37 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index dc0..134ee55 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -168,6 +168,15 @@ static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
 }
 };
 
+static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
+{
+ff_thread_release_buffer(ctx, &f->tf);
+av_buffer_unref(&f->extradata);
+av_buffer_unref(&f->hwaccel_priv_buf);
+f->segmentation_map = NULL;
+f->hwaccel_picture_private = NULL;
+}
+
 static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
 {
 VP9Context *s = ctx->priv_data;
@@ -177,21 +186,28 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame 
*f)
 return ret;
 sz = 64 * s->sb_cols * s->sb_rows;
 if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct 
VP9mvrefPair) {
-ff_thread_release_buffer(ctx, &f->tf);
-return AVERROR(ENOMEM);
+goto fail;
 }
 
 f->segmentation_map = f->extradata->data;
 f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
 
+if (ctx->hwaccel) {
+const AVHWAccel *hwaccel = ctx->hwaccel;
+av_assert0(!f->hwaccel_picture_private);
+if (hwaccel->frame_priv_data_size) {
+f->hwaccel_priv_buf = 
av_buffer_allocz(hwaccel->frame_priv_data_size);
+if (!f->hwaccel_priv_buf)
+goto fail;
+f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
+}
+}
+
 return 0;
-}
 
-static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
-{
-ff_thread_release_buffer(ctx, &f->tf);
-av_buffer_unref(&f->extradata);
-f->segmentation_map = NULL;
+fail:
+vp9_unref_frame(ctx, f);
+return AVERROR(ENOMEM);
 }
 
 static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
@@ -201,19 +217,31 @@ static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame 
*dst, VP9Frame *src)
 if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
 return res;
 } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
-vp9_unref_frame(ctx, dst);
-return AVERROR(ENOMEM);
+goto fail;
 }
 
 dst->segmentation_map = src->segmentation_map;
 dst->mv = src->mv;
 dst->uses_2pass = src->uses_2pass;
 
+if (src->hwaccel_picture_private) {
+dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
+if (!dst->hwaccel_priv_buf)
+goto fail;
+dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
+}
+
 return 0;
+
+fail:
+vp9_unref_frame(ctx, dst);
+return AVERROR(ENOMEM);
 }
 
 static int update_size(AVCodecContext *ctx, int w, int h)
 {
+#define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + CONFIG_VP9_D3D11VA_HWACCEL)
+enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
 VP9Context *s = ctx->priv_data;
 uint8_t *p;
 int bytesperpixel = s->bytesperpixel, res;
@@ -225,7 +253,25 @@ static int update_size(AVCodecContext *ctx, int w, int h)
 
 if ((res = ff_set_dimensions(ctx, w, h)) < 0)
 return res;
-s->last_fmt  = ctx->pix_fmt = s->pix_fmt;
+s->last_fmt  = s->pix_fmt;
+
+if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
+#if CONFIG_VP9_DXVA2_HWACCEL
+*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
+#endif
+#if CONFIG_VP9_D3D11VA_HWACCEL
+*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
+#endif
+}
+
+*fmtp++ = s->pix_fmt;
+*fmtp = AV_PIX_FMT_NONE;
+
+res = ff_thread_get_format(ctx, pix_fmts);
+if (res < 0)
+return res;
+
+ctx->pix_fmt = res;
 s->sb_cols   = (w + 63) >> 6;
 s->sb_rows   = (h + 63) >> 6;
 s->cols  = (w + 7) >> 3;
@@ -573,32 +619,6 @@ static int decode_frame_header(AVCodecContext *ctx,
 s->s.h.varcompref[1] = 2;
 }
 }
-
-for (i = 0; i < 3; i++) {
-AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
-int refw = ref->width, refh = ref->height;
-
-if (ref->format != s->pix_fmt) {
-av_log(ctx, AV_LOG_ERROR,
-   "Ref pixfmt (%s) did not match current frame (%s)",
-   av_get_pix_fmt_name(ref->format),
-   av_get_pix_fmt_name(s->pix_fmt));
-return AVERROR_INVALIDDATA;
-} else if (refw == w && refh == h) {
-s->mvscale[i][0] = s->mvscale[i][1] = 0;
-} else {
-if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 
16 * refh) {
-av_log(ctx, AV_LOG_ERROR,
-   "Invalid ref frame dimensions %dx%d for frame 
size %dx%d\n",
-   refw, refh, w, h);
-return AVERROR_INVALIDDATA;
-}
- 

Re: [FFmpeg-devel] [PATCH] vp9: add hwaccel hooks

2015-12-03 Thread Hendrik Leppkes
On Thu, Dec 3, 2015 at 10:55 AM, Hendrik Leppkes  wrote:
> ---
>  libavcodec/vp9.c | 137 
> ---
>  libavcodec/vp9.h |   3 ++
>  2 files changed, 103 insertions(+), 37 deletions(-)
>
> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> index dc0..134ee55 100644
> --- a/libavcodec/vp9.c
> +++ b/libavcodec/vp9.c
> @@ -168,6 +168,15 @@ static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
>  }
>  };
>
> +static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> +{
> +ff_thread_release_buffer(ctx, &f->tf);
> +av_buffer_unref(&f->extradata);
> +av_buffer_unref(&f->hwaccel_priv_buf);
> +f->segmentation_map = NULL;
> +f->hwaccel_picture_private = NULL;
> +}
> +
>  static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
>  {
>  VP9Context *s = ctx->priv_data;
> @@ -177,21 +186,28 @@ static int vp9_alloc_frame(AVCodecContext *ctx, 
> VP9Frame *f)
>  return ret;
>  sz = 64 * s->sb_cols * s->sb_rows;
>  if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct 
> VP9mvrefPair) {
> -ff_thread_release_buffer(ctx, &f->tf);
> -return AVERROR(ENOMEM);
> +goto fail;
>  }
>
>  f->segmentation_map = f->extradata->data;
>  f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
>
> +if (ctx->hwaccel) {
> +const AVHWAccel *hwaccel = ctx->hwaccel;
> +av_assert0(!f->hwaccel_picture_private);
> +if (hwaccel->frame_priv_data_size) {
> +f->hwaccel_priv_buf = 
> av_buffer_allocz(hwaccel->frame_priv_data_size);
> +if (!f->hwaccel_priv_buf)
> +goto fail;
> +f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
> +}
> +}
> +
>  return 0;
> -}
>
> -static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> -{
> -ff_thread_release_buffer(ctx, &f->tf);
> -av_buffer_unref(&f->extradata);
> -f->segmentation_map = NULL;
> +fail:
> +vp9_unref_frame(ctx, f);
> +return AVERROR(ENOMEM);
>  }
>
>  static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
> @@ -201,19 +217,31 @@ static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame 
> *dst, VP9Frame *src)
>  if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
>  return res;
>  } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
> -vp9_unref_frame(ctx, dst);
> -return AVERROR(ENOMEM);
> +goto fail;
>  }
>
>  dst->segmentation_map = src->segmentation_map;
>  dst->mv = src->mv;
>  dst->uses_2pass = src->uses_2pass;
>
> +if (src->hwaccel_picture_private) {
> +dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
> +if (!dst->hwaccel_priv_buf)
> +goto fail;
> +dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
> +}
> +
>  return 0;
> +
> +fail:
> +vp9_unref_frame(ctx, dst);
> +return AVERROR(ENOMEM);
>  }
>
>  static int update_size(AVCodecContext *ctx, int w, int h)
>  {
> +#define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + CONFIG_VP9_D3D11VA_HWACCEL)
> +enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
>  VP9Context *s = ctx->priv_data;
>  uint8_t *p;
>  int bytesperpixel = s->bytesperpixel, res;
> @@ -225,7 +253,25 @@ static int update_size(AVCodecContext *ctx, int w, int h)
>
>  if ((res = ff_set_dimensions(ctx, w, h)) < 0)
>  return res;
> -s->last_fmt  = ctx->pix_fmt = s->pix_fmt;
> +s->last_fmt  = s->pix_fmt;
> +
> +if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
> +#if CONFIG_VP9_DXVA2_HWACCEL
> +*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
> +#endif
> +#if CONFIG_VP9_D3D11VA_HWACCEL
> +*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
> +#endif
> +}
> +
> +*fmtp++ = s->pix_fmt;
> +*fmtp = AV_PIX_FMT_NONE;
> +
> +res = ff_thread_get_format(ctx, pix_fmts);
> +if (res < 0)
> +return res;
> +
> +ctx->pix_fmt = res;
>  s->sb_cols   = (w + 63) >> 6;
>  s->sb_rows   = (h + 63) >> 6;
>  s->cols  = (w + 7) >> 3;
> @@ -573,32 +619,6 @@ static int decode_frame_header(AVCodecContext *ctx,
>  s->s.h.varcompref[1] = 2;
>  }
>  }
> -
> -for (i = 0; i < 3; i++) {
> -AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
> -int refw = ref->width, refh = ref->height;
> -
> -if (ref->format != s->pix_fmt) {
> -av_log(ctx, AV_LOG_ERROR,
> -   "Ref pixfmt (%s) did not match current frame 
> (%s)",
> -   av_get_pix_fmt_name(ref->format),
> -   av_get_pix_fmt_name(s->pix_fmt));
> -return AVERROR_INVALIDDATA;
> -} else if (refw == w && refh == h) {
> -s->mvscale[i][0] = s->mvscale[i][1] = 0;
> -} else {
> -if (w * 2 < refw || h

Re: [FFmpeg-devel] [PATCH] vp9: add hwaccel hooks

2015-12-03 Thread wm4
On Thu,  3 Dec 2015 10:55:12 +0100
Hendrik Leppkes  wrote:

> ---
>  libavcodec/vp9.c | 137 
> ---
>  libavcodec/vp9.h |   3 ++
>  2 files changed, 103 insertions(+), 37 deletions(-)
> 
> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> index dc0..134ee55 100644
> --- a/libavcodec/vp9.c
> +++ b/libavcodec/vp9.c
> @@ -168,6 +168,15 @@ static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
>  }
>  };
>  
> +static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> +{
> +ff_thread_release_buffer(ctx, &f->tf);
> +av_buffer_unref(&f->extradata);
> +av_buffer_unref(&f->hwaccel_priv_buf);
> +f->segmentation_map = NULL;
> +f->hwaccel_picture_private = NULL;
> +}
> +
>  static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
>  {
>  VP9Context *s = ctx->priv_data;
> @@ -177,21 +186,28 @@ static int vp9_alloc_frame(AVCodecContext *ctx, 
> VP9Frame *f)
>  return ret;
>  sz = 64 * s->sb_cols * s->sb_rows;
>  if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct 
> VP9mvrefPair) {
> -ff_thread_release_buffer(ctx, &f->tf);
> -return AVERROR(ENOMEM);
> +goto fail;
>  }
>  
>  f->segmentation_map = f->extradata->data;
>  f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
>  
> +if (ctx->hwaccel) {
> +const AVHWAccel *hwaccel = ctx->hwaccel;
> +av_assert0(!f->hwaccel_picture_private);
> +if (hwaccel->frame_priv_data_size) {
> +f->hwaccel_priv_buf = 
> av_buffer_allocz(hwaccel->frame_priv_data_size);
> +if (!f->hwaccel_priv_buf)
> +goto fail;
> +f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
> +}
> +}
> +
>  return 0;
> -}
>  
> -static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> -{
> -ff_thread_release_buffer(ctx, &f->tf);
> -av_buffer_unref(&f->extradata);
> -f->segmentation_map = NULL;
> +fail:
> +vp9_unref_frame(ctx, f);
> +return AVERROR(ENOMEM);
>  }
>  
>  static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
> @@ -201,19 +217,31 @@ static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame 
> *dst, VP9Frame *src)
>  if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
>  return res;
>  } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
> -vp9_unref_frame(ctx, dst);
> -return AVERROR(ENOMEM);
> +goto fail;
>  }
>  
>  dst->segmentation_map = src->segmentation_map;
>  dst->mv = src->mv;
>  dst->uses_2pass = src->uses_2pass;
>  
> +if (src->hwaccel_picture_private) {
> +dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
> +if (!dst->hwaccel_priv_buf)
> +goto fail;
> +dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
> +}
> +
>  return 0;
> +
> +fail:
> +vp9_unref_frame(ctx, dst);
> +return AVERROR(ENOMEM);
>  }
>  
>  static int update_size(AVCodecContext *ctx, int w, int h)
>  {
> +#define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + CONFIG_VP9_D3D11VA_HWACCEL)
> +enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
>  VP9Context *s = ctx->priv_data;
>  uint8_t *p;
>  int bytesperpixel = s->bytesperpixel, res;
> @@ -225,7 +253,25 @@ static int update_size(AVCodecContext *ctx, int w, int h)
>  
>  if ((res = ff_set_dimensions(ctx, w, h)) < 0)
>  return res;
> -s->last_fmt  = ctx->pix_fmt = s->pix_fmt;
> +s->last_fmt  = s->pix_fmt;
> +
> +if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
> +#if CONFIG_VP9_DXVA2_HWACCEL
> +*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
> +#endif
> +#if CONFIG_VP9_D3D11VA_HWACCEL
> +*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
> +#endif
> +}
> +
> +*fmtp++ = s->pix_fmt;
> +*fmtp = AV_PIX_FMT_NONE;

I wonder if there should be a nicer way to do that, instead of
duplicating it over all new codecs. (Just thinking loudly.)

> +
> +res = ff_thread_get_format(ctx, pix_fmts);
> +if (res < 0)
> +return res;
> +
> +ctx->pix_fmt = res;
>  s->sb_cols   = (w + 63) >> 6;
>  s->sb_rows   = (h + 63) >> 6;
>  s->cols  = (w + 7) >> 3;
> @@ -573,32 +619,6 @@ static int decode_frame_header(AVCodecContext *ctx,
>  s->s.h.varcompref[1] = 2;
>  }
>  }
> -
> -for (i = 0; i < 3; i++) {
> -AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
> -int refw = ref->width, refh = ref->height;
> -
> -if (ref->format != s->pix_fmt) {
> -av_log(ctx, AV_LOG_ERROR,
> -   "Ref pixfmt (%s) did not match current frame 
> (%s)",
> -   av_get_pix_fmt_name(ref->format),
> -   av_get_pix_fmt_name(s->pix_fmt));
> -return AVERROR_INVALIDDATA;
> -} else if (refw == w && re

Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread Nicolas George
Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> Except that nobody actually did that. It was a thing that was tried
> once, went bust, but somehow it was kept.

Stop making statements about things you do not know. You were not behind all
Debian and Gentoo users' back at the time, nor did you have an account on
their computers. Therefore you do not know what they did or did not install
in /usr/local.

What I do know is that at the time, I did so on the computers I
co-administer, and advised quite a few people to do the same, personally or
on discussion boards. I never had any complain, therefore I think it
actually did work pretty well.

Really, you should stop making that kind of derogatory, unsubstantiated and
false statements.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH 1/2] vp9: add hwaccel hooks

2015-12-03 Thread Hendrik Leppkes
---
 libavcodec/vp9.c | 128 +++
 libavcodec/vp9.h |   3 ++
 2 files changed, 94 insertions(+), 37 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index dc0..87e80d8 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -168,6 +168,15 @@ static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
 }
 };
 
+static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
+{
+ff_thread_release_buffer(ctx, &f->tf);
+av_buffer_unref(&f->extradata);
+av_buffer_unref(&f->hwaccel_priv_buf);
+f->segmentation_map = NULL;
+f->hwaccel_picture_private = NULL;
+}
+
 static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
 {
 VP9Context *s = ctx->priv_data;
@@ -177,21 +186,28 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame 
*f)
 return ret;
 sz = 64 * s->sb_cols * s->sb_rows;
 if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct 
VP9mvrefPair) {
-ff_thread_release_buffer(ctx, &f->tf);
-return AVERROR(ENOMEM);
+goto fail;
 }
 
 f->segmentation_map = f->extradata->data;
 f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
 
+if (ctx->hwaccel) {
+const AVHWAccel *hwaccel = ctx->hwaccel;
+av_assert0(!f->hwaccel_picture_private);
+if (hwaccel->frame_priv_data_size) {
+f->hwaccel_priv_buf = 
av_buffer_allocz(hwaccel->frame_priv_data_size);
+if (!f->hwaccel_priv_buf)
+goto fail;
+f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
+}
+}
+
 return 0;
-}
 
-static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
-{
-ff_thread_release_buffer(ctx, &f->tf);
-av_buffer_unref(&f->extradata);
-f->segmentation_map = NULL;
+fail:
+vp9_unref_frame(ctx, f);
+return AVERROR(ENOMEM);
 }
 
 static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
@@ -201,19 +217,31 @@ static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame 
*dst, VP9Frame *src)
 if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
 return res;
 } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
-vp9_unref_frame(ctx, dst);
-return AVERROR(ENOMEM);
+goto fail;
 }
 
 dst->segmentation_map = src->segmentation_map;
 dst->mv = src->mv;
 dst->uses_2pass = src->uses_2pass;
 
+if (src->hwaccel_picture_private) {
+dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
+if (!dst->hwaccel_priv_buf)
+goto fail;
+dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
+}
+
 return 0;
+
+fail:
+vp9_unref_frame(ctx, dst);
+return AVERROR(ENOMEM);
 }
 
 static int update_size(AVCodecContext *ctx, int w, int h)
 {
+#define HWACCEL_MAX (0)
+enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
 VP9Context *s = ctx->priv_data;
 uint8_t *p;
 int bytesperpixel = s->bytesperpixel, res;
@@ -225,7 +253,16 @@ static int update_size(AVCodecContext *ctx, int w, int h)
 
 if ((res = ff_set_dimensions(ctx, w, h)) < 0)
 return res;
-s->last_fmt  = ctx->pix_fmt = s->pix_fmt;
+s->last_fmt  = s->pix_fmt;
+
+*fmtp++ = s->pix_fmt;
+*fmtp = AV_PIX_FMT_NONE;
+
+res = ff_thread_get_format(ctx, pix_fmts);
+if (res < 0)
+return res;
+
+ctx->pix_fmt = res;
 s->sb_cols   = (w + 63) >> 6;
 s->sb_rows   = (h + 63) >> 6;
 s->cols  = (w + 7) >> 3;
@@ -573,32 +610,6 @@ static int decode_frame_header(AVCodecContext *ctx,
 s->s.h.varcompref[1] = 2;
 }
 }
-
-for (i = 0; i < 3; i++) {
-AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
-int refw = ref->width, refh = ref->height;
-
-if (ref->format != s->pix_fmt) {
-av_log(ctx, AV_LOG_ERROR,
-   "Ref pixfmt (%s) did not match current frame (%s)",
-   av_get_pix_fmt_name(ref->format),
-   av_get_pix_fmt_name(s->pix_fmt));
-return AVERROR_INVALIDDATA;
-} else if (refw == w && refh == h) {
-s->mvscale[i][0] = s->mvscale[i][1] = 0;
-} else {
-if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 
16 * refh) {
-av_log(ctx, AV_LOG_ERROR,
-   "Invalid ref frame dimensions %dx%d for frame 
size %dx%d\n",
-   refw, refh, w, h);
-return AVERROR_INVALIDDATA;
-}
-s->mvscale[i][0] = (refw << 14) / w;
-s->mvscale[i][1] = (refh << 14) / h;
-s->mvstep[i][0] = 16 * s->mvscale[i][0] >> 14;
-s->mvstep[i][1] = 16 * s->mvscale[i][1] >> 14;
-}
-   

[FFmpeg-devel] [PATCH 2/2] avcodec: implement vp9 dxva2 hwaccel

2015-12-03 Thread Hendrik Leppkes
---
 configure  |   5 +
 libavcodec/Makefile|   2 +
 libavcodec/allcodecs.c |   2 +
 libavcodec/dxva2_vp9.c | 338 +
 libavcodec/vp9.c   |  11 +-
 5 files changed, 357 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/dxva2_vp9.c

diff --git a/configure b/configure
index a30d831..4b55d4e 100755
--- a/configure
+++ b/configure
@@ -2528,6 +2528,10 @@ vc1_mmal_hwaccel_deps="mmal"
 vc1_mmal_decoder_select="vc1_decoder"
 vc1_qsv_hwaccel_deps="libmfx"
 vc1_qsv_hwaccel_select="qsvdec_vc1"
+vp9_d3d11va_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
+vp9_d3d11va_hwaccel_select="vp9_decoder"
+vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
+vp9_dxva2_hwaccel_select="vp9_decoder"
 wmv3_crystalhd_decoder_select="crystalhd"
 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
@@ -5260,6 +5264,7 @@ check_lib "CoreServices/CoreServices.h" 
UTGetOSTypeFromString "-framework CoreSe
 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
 
 check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" 
-DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
+check_type "windows.h dxva.h" "DXVA_PicParams_VP9" 
-DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
 check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
 check_type "windows.h d3d11.h" "ID3D11VideoContext"
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index d85215d..b88bbf6 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -745,6 +745,8 @@ OBJS-$(CONFIG_VC1_D3D11VA_HWACCEL)+= dxva2_vc1.o
 OBJS-$(CONFIG_VC1_DXVA2_HWACCEL)  += dxva2_vc1.o
 OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)  += vaapi_vc1.o
 OBJS-$(CONFIG_VC1_VDPAU_HWACCEL)  += vdpau_vc1.o
+OBJS-$(CONFIG_VP9_D3D11VA_HWACCEL)+= dxva2_vp9.o
+OBJS-$(CONFIG_VP9_DXVA2_HWACCEL)  += dxva2_vp9.o
 
 # libavformat dependencies
 OBJS-$(CONFIG_ADTS_MUXER)  += mpeg4audio.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 9f60d7c..245332e 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -110,6 +110,8 @@ void avcodec_register_all(void)
 REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
 REGISTER_HWACCEL(VC1_MMAL,  vc1_mmal);
 REGISTER_HWACCEL(VC1_QSV,   vc1_qsv);
+REGISTER_HWACCEL(VP9_D3D11VA,   vp9_d3d11va);
+REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
 REGISTER_HWACCEL(WMV3_D3D11VA,  wmv3_d3d11va);
 REGISTER_HWACCEL(WMV3_DXVA2,wmv3_dxva2);
 REGISTER_HWACCEL(WMV3_VAAPI,wmv3_vaapi);
diff --git a/libavcodec/dxva2_vp9.c b/libavcodec/dxva2_vp9.c
new file mode 100644
index 000..9a1255f
--- /dev/null
+++ b/libavcodec/dxva2_vp9.c
@@ -0,0 +1,338 @@
+/*
+ * DXVA2 VP9 HW acceleration.
+ *
+ * copyright (c) 2015 Hendrik Leppkes
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/pixdesc.h"
+
+#include "vp9.h"
+
+// The headers above may include w32threads.h, which uses the original
+// _WIN32_WINNT define, while dxva2_internal.h redefines it to target a
+// potentially newer version.
+#include "dxva2_internal.h"
+
+struct vp9_dxva2_picture_context {
+DXVA_PicParams_VP9pp;
+DXVA_Slice_VPx_Short  slice;
+const uint8_t *bitstream;
+unsigned  bitstream_size;
+};
+
+static void fill_picture_entry(DXVA_PicEntry_VPx *pic,
+   unsigned index, unsigned flag)
+{
+av_assert0((index & 0x7f) == index && (flag & 0x01) == flag);
+pic->bPicEntry = index | (flag << 7);
+}
+
+static int fill_picture_parameters(const AVCodecContext *avctx, AVDXVAContext 
*ctx, const VP9SharedContext *h,
+DXVA_PicParams_VP9 *pp)
+{
+int i;
+const AVPixFmtDescriptor * pixdesc = 
av_pix_fmt_desc_get(avctx->sw_pix_fmt);
+
+if (!pixdesc)
+return -1;
+
+memset(pp, 0, sizeof(*pp));
+
+fill_picture_entry(&pp->CurrPic, ff_dxva2_get_surface_index(avctx, ctx, 
h->frames[CUR_FRAME].tf.f), 0);
+
+pp->profile = h->h.profile;
+pp->wFormatAndPictureInfoFlags = ((h->

Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread wm4
On Thu, 3 Dec 2015 11:02:38 +0100
Nicolas George  wrote:

> Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> > Except that nobody actually did that. It was a thing that was tried
> > once, went bust, but somehow it was kept.  
> 
> Stop making statements about things you do not know. You were not behind all
> Debian and Gentoo users' back at the time, nor did you have an account on
> their computers. Therefore you do not know what they did or did not install
> in /usr/local.

Neither do you.

> 
> What I do know is that at the time, I did so on the computers I
> co-administer, and advised quite a few people to do the same, personally or
> on discussion boards. I never had any complain, therefore I think it
> actually did work pretty well.

Too small sample size, and only at one point in time (at the very
beginning).

I never even doubted that it worked at the beginning, but now it's an
anachronism that causes problems like the patch at hand tries to solve.
 
> Really, you should stop making that kind of derogatory, unsubstantiated and
> false statements.

So what do you consider calling someone else a "caricature"?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread Nicolas George
Le tridi 13 frimaire, an CCXXIV, wm4 a écrit :
> Too small sample size,

One is enough to refute "nobody".

> I never even doubted that it worked at the beginning

Then stop bitching, because it is exactly what this discussion is abut: it
DID work, it DID make users' life easier. It no longer does, so we can
remove it, but pretending it was useless from the start is insulting.

> So what do you consider calling someone else a "caricature"?

A reply in kind.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread Paul B Mahol
On 12/3/15, Nicolas George  wrote:
> Le tridi 13 frimaire, an CCXXIV, wm4 a ecrit :
>> Too small sample size,
>
> One is enough to refute "nobody".
>
>> I never even doubted that it worked at the beginning
>
> Then stop bitching, because it is exactly what this discussion is abut: it
> DID work, it DID make users' life easier. It no longer does, so we can
> remove it, but pretending it was useless from the start is insulting.
>
>> So what do you consider calling someone else a "caricature"?
>
> A reply in kind.

Could you two take a room?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/5] lavf: add FFERROR_REDO to let demuxer return no packet.

2015-12-03 Thread Stefano Sabatini
On date Friday 2015-11-27 19:16:06 +0100, Nicolas George encoded:
> Signed-off-by: Nicolas George 
> ---
>  libavformat/internal.h | 6 ++
>  libavformat/utils.c| 5 +
>  2 files changed, 11 insertions(+)
> 
> 
> Apparently, the most unhappyness was caused by the error code in the public
> API. This is not the case here.
> 
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index ee86094..0f684bd 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -516,4 +516,10 @@ int ff_copy_whitelists(AVFormatContext *dst, 
> AVFormatContext *src);
>  int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const 
> char *url, int flags,
> const AVIOInterruptCB *int_cb, AVDictionary 
> **options);
>  
> +/**
> + * Returned by demuxers to indicate that data was consumed but discarded
> + * (ignored streams or junk data). The framework will re-call the demuxer.
> + */
> +#define FFERROR_REDO FFERRTAG( 'R','E','D','O')
> +
>  #endif /* AVFORMAT_INTERNAL_H */
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 8cb7d38..83e2f73 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -680,6 +680,11 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>  av_init_packet(pkt);
>  ret = s->iformat->read_packet(s, pkt);
>  if (ret < 0) {
> +/* Some demuxer (FLV, MPEG-PS) return FFERROR_REDO when they
> +   data and discard it (ignored streams, junk, extradata).
> +   We must re-call the demuxer to get the real packet. */
> +if (ret == FFERROR_REDO)
> +continue;

LGTM with the changes suggested in the other comments. In particular:

/* Some demuxers return FFERROR_REDO when they provide
   data and discard it (ignored streams, junk, extradata).
   We must re-call the demuxer to get the real packet. */

Thanks.
-- 
FFmpeg = Frightening Forgiving Marvellous Powered Exxagerate Gorilla
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/5] lavf/flvdec: use FFERROR_REDO instead of AVERROR(EAGAIN).

2015-12-03 Thread Stefano Sabatini
On date Friday 2015-11-27 19:16:07 +0100, Nicolas George encoded:
> Fix trac ticket #5041.
> 
> Signed-off-by: Nicolas George 
> ---
>  libavformat/flvdec.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> 
> Problem can be observed by transcoding or remuxing a large FLV with both
> audio and video with and without -an or -vn and observing the speed and CPU
> usage.
> 
> 
> diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
> index ca73969..c003e70 100644
> --- a/libavformat/flvdec.c
> +++ b/libavformat/flvdec.c
> @@ -882,7 +882,7 @@ retry:
>  }
>  
>  if (size == 0) {
> -ret = AVERROR(EAGAIN);
> +ret = FFERROR_REDO;
>  goto leave;
>  }
>  
> @@ -927,13 +927,13 @@ retry:
> type, size, flags);
>  skip:
>  avio_seek(s->pb, next, SEEK_SET);
> -ret = AVERROR(EAGAIN);
> +ret = FFERROR_REDO;
>  goto leave;
>  }
>  
>  /* skip empty data packets */
>  if (!size) {
> -ret = AVERROR(EAGAIN);
> +ret = FFERROR_REDO;
>  goto leave;
>  }
>  
> @@ -973,7 +973,7 @@ skip:
>  || st->discard >= AVDISCARD_ALL
>  ) {
>  avio_seek(s->pb, next, SEEK_SET);
> -ret = AVERROR(EAGAIN);
> +ret = FFERROR_REDO;
>  goto leave;
>  }
>  
> @@ -1068,7 +1068,7 @@ retry_duration:
>  if (st->codec->extradata) {
>  if ((ret = flv_queue_extradata(flv, s->pb, stream_type, 
> size)) < 0)
>  return ret;
> -ret = AVERROR(EAGAIN);
> +ret = FFERROR_REDO;
>  goto leave;
>  }
>  if ((ret = flv_get_extradata(s, st, size)) < 0)
> @@ -1095,14 +1095,14 @@ retry_duration:
>  }
>  }
>  
> -ret = AVERROR(EAGAIN);
> +ret = FFERROR_REDO;
>  goto leave;
>  }
>  }
>  
>  /* skip empty data packets */
>  if (!size) {
> -ret = AVERROR(EAGAIN);
> +ret = FFERROR_REDO;
>  goto leave;
>  }

LGTM.
-- 
FFmpeg = Faithful Furious Mastering Puritan Efficient God
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] vp9: add hwaccel hooks

2015-12-03 Thread Hendrik Leppkes
On Thu, Dec 3, 2015 at 11:13 AM, Hendrik Leppkes  wrote:
> ---
>  libavcodec/vp9.c | 128 
> +++
>  libavcodec/vp9.h |   3 ++
>  2 files changed, 94 insertions(+), 37 deletions(-)
>
> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> index dc0..87e80d8 100644
> --- a/libavcodec/vp9.c
> +++ b/libavcodec/vp9.c
> @@ -168,6 +168,15 @@ static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
>  }
>  };
>
> +static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> +{
> +ff_thread_release_buffer(ctx, &f->tf);
> +av_buffer_unref(&f->extradata);
> +av_buffer_unref(&f->hwaccel_priv_buf);
> +f->segmentation_map = NULL;
> +f->hwaccel_picture_private = NULL;
> +}
> +
>  static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
>  {
>  VP9Context *s = ctx->priv_data;
> @@ -177,21 +186,28 @@ static int vp9_alloc_frame(AVCodecContext *ctx, 
> VP9Frame *f)
>  return ret;
>  sz = 64 * s->sb_cols * s->sb_rows;
>  if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct 
> VP9mvrefPair) {
> -ff_thread_release_buffer(ctx, &f->tf);
> -return AVERROR(ENOMEM);
> +goto fail;
>  }
>
>  f->segmentation_map = f->extradata->data;
>  f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
>
> +if (ctx->hwaccel) {
> +const AVHWAccel *hwaccel = ctx->hwaccel;
> +av_assert0(!f->hwaccel_picture_private);
> +if (hwaccel->frame_priv_data_size) {
> +f->hwaccel_priv_buf = 
> av_buffer_allocz(hwaccel->frame_priv_data_size);
> +if (!f->hwaccel_priv_buf)
> +goto fail;
> +f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
> +}
> +}
> +
>  return 0;
> -}
>
> -static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> -{
> -ff_thread_release_buffer(ctx, &f->tf);
> -av_buffer_unref(&f->extradata);
> -f->segmentation_map = NULL;
> +fail:
> +vp9_unref_frame(ctx, f);
> +return AVERROR(ENOMEM);
>  }
>
>  static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
> @@ -201,19 +217,31 @@ static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame 
> *dst, VP9Frame *src)
>  if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
>  return res;
>  } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
> -vp9_unref_frame(ctx, dst);
> -return AVERROR(ENOMEM);
> +goto fail;
>  }
>
>  dst->segmentation_map = src->segmentation_map;
>  dst->mv = src->mv;
>  dst->uses_2pass = src->uses_2pass;
>
> +if (src->hwaccel_picture_private) {
> +dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
> +if (!dst->hwaccel_priv_buf)
> +goto fail;
> +dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
> +}
> +
>  return 0;
> +
> +fail:
> +vp9_unref_frame(ctx, dst);
> +return AVERROR(ENOMEM);
>  }
>
>  static int update_size(AVCodecContext *ctx, int w, int h)
>  {
> +#define HWACCEL_MAX (0)
> +enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
>  VP9Context *s = ctx->priv_data;
>  uint8_t *p;
>  int bytesperpixel = s->bytesperpixel, res;
> @@ -225,7 +253,16 @@ static int update_size(AVCodecContext *ctx, int w, int h)
>
>  if ((res = ff_set_dimensions(ctx, w, h)) < 0)
>  return res;
> -s->last_fmt  = ctx->pix_fmt = s->pix_fmt;
> +s->last_fmt  = s->pix_fmt;
> +
> +*fmtp++ = s->pix_fmt;
> +*fmtp = AV_PIX_FMT_NONE;
> +
> +res = ff_thread_get_format(ctx, pix_fmts);
> +if (res < 0)
> +return res;
> +
> +ctx->pix_fmt = res;

I should probably move setting s->last_fmt below the get_format call
to avoid re-introducing the bug of state de-syncing when some other
error occured.

>  s->sb_cols   = (w + 63) >> 6;
>  s->sb_rows   = (h + 63) >> 6;
>  s->cols  = (w + 7) >> 3;
> @@ -573,32 +610,6 @@ static int decode_frame_header(AVCodecContext *ctx,
>  s->s.h.varcompref[1] = 2;
>  }
>  }
> -
> -for (i = 0; i < 3; i++) {
> -AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
> -int refw = ref->width, refh = ref->height;
> -
> -if (ref->format != s->pix_fmt) {
> -av_log(ctx, AV_LOG_ERROR,
> -   "Ref pixfmt (%s) did not match current frame 
> (%s)",
> -   av_get_pix_fmt_name(ref->format),
> -   av_get_pix_fmt_name(s->pix_fmt));
> -return AVERROR_INVALIDDATA;
> -} else if (refw == w && refh == h) {
> -s->mvscale[i][0] = s->mvscale[i][1] = 0;
> -} else {
> -if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 
> 16 * refh) {
> -av_log(ctx, AV_LOG_ERROR,
> - 

Re: [FFmpeg-devel] [PATCH 3/3] libavcodec/aacsbr_tablegen: fix tablegen on windows

2015-12-03 Thread Hendrik Leppkes
On Wed, Dec 2, 2015 at 9:52 AM, Hendrik Leppkes  wrote:
> Including these headers is not needed and breaks building on Windows as it
> tries to activate the full compat tools, which are not needed for host
> tools.
> ---
>  libavcodec/aacsbr_fixed_tablegen.c  | 3 ---
>  libavcodec/aacsbr_tablegen.c| 3 ---
>  libavcodec/aacsbr_tablegen_common.h | 3 ++-
>  3 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/aacsbr_fixed_tablegen.c 
> b/libavcodec/aacsbr_fixed_tablegen.c
> index b896d75..832fcb7 100644
> --- a/libavcodec/aacsbr_fixed_tablegen.c
> +++ b/libavcodec/aacsbr_fixed_tablegen.c
> @@ -21,9 +21,6 @@
>   */
>
>  #include 
> -#include "libavutil/internal.h"
> -#include "libavutil/common.h"
> -#undef CONFIG_HARDCODED_TABLES
>  #define CONFIG_HARDCODED_TABLES 0
>  #define USE_FIXED 1
>  #include "aacsbr_fixed_tablegen.h"
> diff --git a/libavcodec/aacsbr_tablegen.c b/libavcodec/aacsbr_tablegen.c
> index ee0d818..c331c57 100644
> --- a/libavcodec/aacsbr_tablegen.c
> +++ b/libavcodec/aacsbr_tablegen.c
> @@ -21,9 +21,6 @@
>   */
>
>  #include 
> -#include "libavutil/internal.h"
> -#include "libavutil/common.h"
> -#undef CONFIG_HARDCODED_TABLES
>  #define CONFIG_HARDCODED_TABLES 0
>  #define USE_FIXED 0
>  #include "aacsbr_tablegen.h"
> diff --git a/libavcodec/aacsbr_tablegen_common.h 
> b/libavcodec/aacsbr_tablegen_common.h
> index 0a64552..d7fc306 100644
> --- a/libavcodec/aacsbr_tablegen_common.h
> +++ b/libavcodec/aacsbr_tablegen_common.h
> @@ -22,7 +22,8 @@
>
>  #ifndef AVCODEC_AACSBR_TABLEGEN_COMMON_H
>  #define AVCODEC_AACSBR_TABLEGEN_COMMON_H
> -#include "aac.h"
> +#include "aac_defines.h"
> +#include "libavutil/mem.h"
>
>  #if CONFIG_HARDCODED_TABLES
>  #define aacsbr_tableinit()
> --
> 2.6.2.windows.1
>

Last chance for anyone to review, otherwise I'll push it in a day or so.
Was tested using MSVC and GCC using hardcoded tables and runtime tables.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avutil/crc: avoid needless space wastage of hardcoded crc table

2015-12-03 Thread Ganesh Ajjanagadde
On Thu, Dec 3, 2015 at 2:26 AM, Nicolas George  wrote:
> Le tridi 13 frimaire, an CCXXIV, Ganesh Ajjanagadde a écrit :
>> There was no reason AFAIK for making AV_CRC_24_IEEE 12.
>
> The reason was to leave room for the fork to add its own new constants
> without causing ABI incompatibilities.

Thanks for clarifying.

>
> Regards,
>
> --
>   Nicolas George
>
> ___
> 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 v3 01/14] mips: rename mipsdspr1 to mipsdsp

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Document it in the Changelog

Changes v1 -> v2:
 - Remove a block of code for mipsdspr2 which wasn't intended to be in
   this patch and it was causing a syntax error in the configure script.
   Highlighted by Michael Niedermayer:
   https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183444.html

 Changelog |  1 +
 Makefile  |  2 +-
 arch.mak  |  2 +-
 configure | 28 ++--
 libavcodec/aacenc.c   |  2 +-
 libavcodec/mips/Makefile  |  4 ++--
 libavcodec/mips/ac3dsp_mips.c |  4 ++--
 libavcodec/mips/mpegaudiodsp_mips_fixed.c |  2 +-
 libavcodec/mpegaudiodec_template.c|  4 ++--
 libavcodec/mpegaudiodsp.c |  2 +-
 libavcodec/mpegaudiodsp.h |  2 +-
 11 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/Changelog b/Changelog
index 2d2a92b..600ffea 100644
--- a/Changelog
+++ b/Changelog
@@ -39,6 +39,7 @@ version :
 - support encoding 16-bit RLE SGI images
 - apulsator filter
 - sidechaingate audio filter
+- mipsdspr1 option has been renamed to mipsdsp
 
 
 version 2.8:
diff --git a/Makefile b/Makefile
index 58f1a3a..7836a20 100644
--- a/Makefile
+++ b/Makefile
@@ -85,7 +85,7 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS 
TOOLS  \
HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS\
ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \
ALTIVEC-OBJS MMX-OBJS YASM-OBJS   \
-   MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MSA-OBJS   \
+   MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \
MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS
 
 define RESET
diff --git a/arch.mak b/arch.mak
index 98fde4a..08f78b4 100644
--- a/arch.mak
+++ b/arch.mak
@@ -5,7 +5,7 @@ OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes)
 OBJS-$(HAVE_NEON)+= $(NEON-OBJS)$(NEON-OBJS-yes)
 
 OBJS-$(HAVE_MIPSFPU)   += $(MIPSFPU-OBJS)$(MIPSFPU-OBJS-yes)
-OBJS-$(HAVE_MIPSDSPR1) += $(MIPSDSPR1-OBJS)  $(MIPSDSPR1-OBJS-yes)
+OBJS-$(HAVE_MIPSDSP)   += $(MIPSDSP-OBJS)$(MIPSDSP-OBJS-yes)
 OBJS-$(HAVE_MIPSDSPR2) += $(MIPSDSPR2-OBJS)  $(MIPSDSPR2-OBJS-yes)
 OBJS-$(HAVE_MSA)   += $(MSA-OBJS)$(MSA-OBJS-yes)
 OBJS-$(HAVE_MMI)   += $(MMI-OBJS)   $(MMI-OBJS-yes)
diff --git a/configure b/configure
index a30d831..ea2a746 100755
--- a/configure
+++ b/configure
@@ -384,7 +384,7 @@ Optimization options (experts only):
   --disable-yasm   disable use of nasm/yasm assembly
   --disable-mips32r5   disable MIPS32R5 optimizations
   --disable-mips64r6   disable MIPS64R6 optimizations
-  --disable-mipsdspr1  disable MIPS DSP ASE R1 optimizations
+  --disable-mipsdspdisable MIPS DSP ASE R1 optimizations
   --disable-mipsdspr2  disable MIPS DSP ASE R2 optimizations
   --disable-msadisable MSA optimizations
   --disable-mipsfpudisable floating point MIPS optimizations
@@ -1633,7 +1633,7 @@ ARCH_EXT_LIST_MIPS="
 mips32r2
 mips32r5
 mips64r6
-mipsdspr1
+mipsdsp
 mipsdspr2
 msa
 "
@@ -2106,7 +2106,7 @@ setend_deps="arm"
 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
 
 mipsfpu_deps="mips"
-mipsdspr1_deps="mips"
+mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
 mips32r2_deps="mips"
 mips32r5_deps="mips"
@@ -4068,14 +4068,14 @@ elif enabled mips; then
 disable mips32r5
 disable mips64r6
 disable mipsfpu
-disable mipsdspr1
+disable mipsdsp
 disable mipsdspr2
 disable msa
 ;;
 24kf*)
 disable mips32r5
 disable mips64r6
-disable mipsdspr1
+disable mipsdsp
 disable mipsdspr2
 disable msa
 ;;
@@ -4105,14 +4105,14 @@ elif enabled mips; then
 ;;
 p5600)
 disable mips64r6
-disable mipsdspr1
+disable mipsdsp
 disable mipsdspr2
 
 check_cflags "-mtune=p5600"
 ;;
 i6400)
 disable mips32r5
-disable mipsdspr1
+disable mipsdsp
 disable mipsdspr2
 disable mipsfpu
 
@@ -4124,7 +4124,7 @@ elif enabled mips; then
 disable mips32r2
 disable mips32r5
 disable mips64r6
-disable mipsdspr1
+disable mipsdsp
 disable mipsdspr2
 disable msa
 enable local_aligned_8 local_aligned_16 local_aligned_32
@@ -4156,7 +4156,7 @@ elif enabled mips; then
 disable mips32r2
 disable mips32r5
 disable mips64r6
-disable mipsdspr1
+disable mipsdsp
 d

[FFmpeg-devel] [PATCH v3 02/14] mips: remove --mips32r5 configure option

2015-12-03 Thread Vicente Olivert Riera
Having a configure option with the same name as a MIPS ISA is confusing,
so better to remove it. This option was being used to add some
optimizations to a specific core (p5600). We will add the optimizations
just when the p5600 core has been detected, in a later patch.

Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Document it in the Changelog.

Changes v1 -> v2:
 - Nothing.

 Changelog |  2 +-
 configure | 20 +---
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/Changelog b/Changelog
index 600ffea..c28d854 100644
--- a/Changelog
+++ b/Changelog
@@ -40,7 +40,7 @@ version :
 - apulsator filter
 - sidechaingate audio filter
 - mipsdspr1 option has been renamed to mipsdsp
-
+- mips32r5 option has been removed
 
 version 2.8:
 - colorkey video filter
diff --git a/configure b/configure
index ea2a746..d0631a0 100755
--- a/configure
+++ b/configure
@@ -382,7 +382,6 @@ Optimization options (experts only):
   --disable-neon   disable NEON optimizations
   --disable-inline-asm disable use of inline assembly
   --disable-yasm   disable use of nasm/yasm assembly
-  --disable-mips32r5   disable MIPS32R5 optimizations
   --disable-mips64r6   disable MIPS64R6 optimizations
   --disable-mipsdspdisable MIPS DSP ASE R1 optimizations
   --disable-mipsdspr2  disable MIPS DSP ASE R2 optimizations
@@ -1631,7 +1630,6 @@ ARCH_EXT_LIST_ARM="
 ARCH_EXT_LIST_MIPS="
 mipsfpu
 mips32r2
-mips32r5
 mips64r6
 mipsdsp
 mipsdspr2
@@ -2109,7 +2107,6 @@ mipsfpu_deps="mips"
 mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
 mips32r2_deps="mips"
-mips32r5_deps="mips"
 mips64r6_deps="mips"
 msa_deps="mips"
 mmi_deps="mips"
@@ -4065,7 +4062,6 @@ elif enabled mips; then
 
 case $cpu in
 24kc)
-disable mips32r5
 disable mips64r6
 disable mipsfpu
 disable mipsdsp
@@ -4073,33 +4069,28 @@ elif enabled mips; then
 disable msa
 ;;
 24kf*)
-disable mips32r5
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
 disable msa
 ;;
 24kec|34kc|1004kc)
-disable mips32r5
 disable mips64r6
 disable mipsfpu
 disable mipsdspr2
 disable msa
 ;;
 24kef*|34kf*|1004kf*)
-disable mips32r5
 disable mips64r6
 disable mipsdspr2
 disable msa
 ;;
 74kc)
-disable mips32r5
 disable mips64r6
 disable mipsfpu
 disable msa
 ;;
 74kf)
-disable mips32r5
 disable mips64r6
 disable msa
 ;;
@@ -4111,7 +4102,6 @@ elif enabled mips; then
 check_cflags "-mtune=p5600"
 ;;
 i6400)
-disable mips32r5
 disable mipsdsp
 disable mipsdspr2
 disable mipsfpu
@@ -4122,7 +4112,6 @@ elif enabled mips; then
 loongson*)
 disable mipsfpu
 disable mips32r2
-disable mips32r5
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
@@ -4147,14 +4136,12 @@ elif enabled mips; then
 esac
 ;;
 generic)
-disable mips32r5
 disable mips64r6
 disable msa
 ;;
 *)
 disable mipsfpu
 disable mips32r2
-disable mips32r5
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
@@ -4961,14 +4948,11 @@ elif enabled mips; then
 elif enabled mipsdsp || enabled mipsdspr2; then
 add_cflags "-mips32r2 -mfp32"
 add_asflags "-mips32r2 -mfp32"
-elif enabled mips32r5 || enabled mips64r6; then
+elif enabled mips64r6; then
 check_cflags "-mfp64"
 check_ldflags "-mfp64"
 fi
 
-enabled mips32r5  && check_cflags "-mips32r5 -msched-weight 
-mload-store-pairs -funroll-loops" &&
- check_ldflags "-mips32r5" &&
- check_inline_asm mips32r5  '"ulw $t0, ($t1)"'
 enabled mips64r6  && check_cflags "-mips64r6 -msched-weight 
-mload-store-pairs -funroll-loops" &&
  check_ldflags "-mips64r6" &&
  check_inline_asm mips64r6  '"aui $t0, $t1, 1"'
@@ -4981,7 +4965,6 @@ elif enabled mips; then
 enabled msa   && check_cflags "-mmsa" && check_ldflags "-mmsa" &&
  check_inline_asm msa   '"addvi.b $w0, $w1, 1"'
 
-enabled mips32r5 && add_asflags "-mips32r5 -mfp64"
 enabled mips64r6 && add_asflags "-mips64r6 -mfp64"
 enabled msa && add_asflags "-mmsa"
 
@@ -6049,7 +6032,6 @@ if enabled arm; then
 fi
 if enabled mips; then
 echo "MIPS FPU enabled  ${mipsfpu-no}"
-echo "MIPS32R5 enabled  ${mips32r5-no}"
 echo "MIPS64R6 enabled  ${mips64r6-no}"
 echo "MIPS DSP R1 enabled   ${mipsdsp-no}"
 echo "MIPS DSP R2 enab

[FFmpeg-devel] [PATCH v3 04/14] mips: remove --mips64r6 configure option

2015-12-03 Thread Vicente Olivert Riera
Having a configure option with the same name as a MIPS ISA is confusing,
so better to remove it. This option was being used to add some
optimizations to a specific core (i6400). We will add the optimizations
just when the i6400 core has been detected, in a later patch.

Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Document it in the Changelog.

Changes v1 -> v2:
 - Nothing.

 Changelog | 1 +
 configure | 9 -
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/Changelog b/Changelog
index c28d854..705742f 100644
--- a/Changelog
+++ b/Changelog
@@ -41,6 +41,7 @@ version :
 - sidechaingate audio filter
 - mipsdspr1 option has been renamed to mipsdsp
 - mips32r5 option has been removed
+- mips64r6 option has been removed
 
 version 2.8:
 - colorkey video filter
diff --git a/configure b/configure
index 0397ea1..24ea270 100755
--- a/configure
+++ b/configure
@@ -382,7 +382,6 @@ Optimization options (experts only):
   --disable-neon   disable NEON optimizations
   --disable-inline-asm disable use of inline assembly
   --disable-yasm   disable use of nasm/yasm assembly
-  --disable-mips64r6   disable MIPS64R6 optimizations
   --disable-mipsdspdisable MIPS DSP ASE R1 optimizations
   --disable-mipsdspr2  disable MIPS DSP ASE R2 optimizations
   --disable-msadisable MSA optimizations
@@ -4949,14 +4948,8 @@ elif enabled mips; then
 elif enabled mipsdsp || enabled mipsdspr2; then
 add_cflags "-mips32r2 -mfp32"
 add_asflags "-mips32r2 -mfp32"
-elif enabled mips64r6; then
-check_cflags "-mfp64"
-check_ldflags "-mfp64"
 fi
 
-enabled mips64r6  && check_cflags "-mips64r6 -msched-weight 
-mload-store-pairs -funroll-loops" &&
- check_ldflags "-mips64r6" &&
- check_inline_asm mips64r6  '"aui $t0, $t1, 1"'
 enabled mipsdsp && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"'
 enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
@@ -4966,7 +4959,6 @@ elif enabled mips; then
 enabled msa   && check_cflags "-mmsa" && check_ldflags "-mmsa" &&
  check_inline_asm msa   '"addvi.b $w0, $w1, 1"'
 
-enabled mips64r6 && add_asflags "-mips64r6 -mfp64"
 enabled msa && add_asflags "-mmsa"
 
 elif enabled parisc; then
@@ -6033,7 +6025,6 @@ if enabled arm; then
 fi
 if enabled mips; then
 echo "MIPS FPU enabled  ${mipsfpu-no}"
-echo "MIPS64R6 enabled  ${mips64r6-no}"
 echo "MIPS DSP R1 enabled   ${mipsdsp-no}"
 echo "MIPS DSP R2 enabled   ${mipsdspr2-no}"
 echo "MIPS MSA enabled  ${msa-no}"
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 03/14] mips: add p5600 core optimizations

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Nothing.

 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d0631a0..0397ea1 100755
--- a/configure
+++ b/configure
@@ -4098,8 +4098,9 @@ elif enabled mips; then
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
-
-check_cflags "-mtune=p5600"
+check_cflags "-mtune=p5600" &&
+check_cflags "-mfp64 -msched-weight -mload-store-pairs 
-funroll-loops" &&
+add_asflags "-mfp64"
 ;;
 i6400)
 disable mipsdsp
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 05/14] mips: add i6400 core optimizations

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Nothing.

 configure | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 24ea270..62dd3a4 100755
--- a/configure
+++ b/configure
@@ -4105,9 +4105,10 @@ elif enabled mips; then
 disable mipsdsp
 disable mipsdspr2
 disable mipsfpu
-
-check_cflags "-mtune=i6400 -mabi=64"
-check_ldflags "-mabi=64"
+check_cflags "-mtune=i6400 -mabi=64" &&
+check_cflags "-mfp64 -msched-weight -mload-store-pairs 
-funroll-loops" &&
+check_ldflags "-mabi=64" &&
+add_asflags "-mfp64"
 ;;
 loongson*)
 disable mipsfpu
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 06/14] mips: i6400 core does have an FPU, so not disable it

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Fix a grammar mistake in the commit log. Change "do has" by "does
   have". Thanks to Moritz Barsnick:
   https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183437.html

configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index 62dd3a4..045f5bf 100755
--- a/configure
+++ b/configure
@@ -4104,7 +4104,6 @@ elif enabled mips; then
 i6400)
 disable mipsdsp
 disable mipsdspr2
-disable mipsfpu
 check_cflags "-mtune=i6400 -mabi=64" &&
 check_cflags "-mfp64 -msched-weight -mload-store-pairs 
-funroll-loops" &&
 check_ldflags "-mabi=64" &&
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 08/14] mips: add mips64r2 architecture variant

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Nothing.

 configure | 12 
 1 file changed, 12 insertions(+)

diff --git a/configure b/configure
index ca6e0a0..0254e9a 100755
--- a/configure
+++ b/configure
@@ -1629,6 +1629,7 @@ ARCH_EXT_LIST_ARM="
 ARCH_EXT_LIST_MIPS="
 mipsfpu
 mips32r2
+mips64r2
 mips64r6
 mipsdsp
 mipsdspr2
@@ -2106,6 +2107,7 @@ mipsfpu_deps="mips"
 mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
 mips32r2_deps="mips"
+mips64r2_deps="mips"
 mips64r6_deps="mips"
 msa_deps="mips"
 mmi_deps="mips"
@@ -4061,6 +4063,7 @@ elif enabled mips; then
 
 case $cpu in
 24kc)
+disable mips64r2
 disable mips64r6
 disable mipsfpu
 disable mipsdsp
@@ -4068,32 +4071,38 @@ elif enabled mips; then
 disable msa
 ;;
 24kf*)
+disable mips64r2
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
 disable msa
 ;;
 24kec|34kc|1004kc)
+disable mips64r2
 disable mips64r6
 disable mipsfpu
 disable mipsdspr2
 disable msa
 ;;
 24kef*|34kf*|1004kf*)
+disable mips64r2
 disable mips64r6
 disable mipsdspr2
 disable msa
 ;;
 74kc)
+disable mips64r2
 disable mips64r6
 disable mipsfpu
 disable msa
 ;;
 74kf)
+disable mips64r2
 disable mips64r6
 disable msa
 ;;
 p5600)
+disable mips64r2
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
@@ -4103,6 +4112,7 @@ elif enabled mips; then
 ;;
 i6400)
 disable mips32r2
+disable mips64r2
 disable mipsdsp
 disable mipsdspr2
 check_cflags "-mtune=i6400 -mabi=64" &&
@@ -4113,6 +4123,7 @@ elif enabled mips; then
 loongson*)
 disable mipsfpu
 disable mips32r2
+disable mips64r2
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
@@ -4143,6 +4154,7 @@ elif enabled mips; then
 *)
 disable mipsfpu
 disable mips32r2
+disable mips64r2
 disable mips64r6
 disable mipsdsp
 disable mipsdspr2
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 07/14] mips: i6400 core is not mips32r2, so disable mips32r2

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Nothing.

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 045f5bf..ca6e0a0 100755
--- a/configure
+++ b/configure
@@ -4102,6 +4102,7 @@ elif enabled mips; then
 add_asflags "-mfp64"
 ;;
 i6400)
+disable mips32r2
 disable mipsdsp
 disable mipsdspr2
 check_cflags "-mtune=i6400 -mabi=64" &&
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 09/14] mips: add mips32r6 architecture variant

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Nothing.

 configure | 12 
 1 file changed, 12 insertions(+)

diff --git a/configure b/configure
index 0254e9a..5cf487a 100755
--- a/configure
+++ b/configure
@@ -1630,6 +1630,7 @@ ARCH_EXT_LIST_MIPS="
 mipsfpu
 mips32r2
 mips64r2
+mips32r6
 mips64r6
 mipsdsp
 mipsdspr2
@@ -2107,6 +2108,7 @@ mipsfpu_deps="mips"
 mipsdsp_deps="mips"
 mipsdspr2_deps="mips"
 mips32r2_deps="mips"
+mips32r6_deps="mips"
 mips64r2_deps="mips"
 mips64r6_deps="mips"
 msa_deps="mips"
@@ -4063,6 +4065,7 @@ elif enabled mips; then
 
 case $cpu in
 24kc)
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsfpu
@@ -4071,6 +4074,7 @@ elif enabled mips; then
 disable msa
 ;;
 24kf*)
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsdsp
@@ -4078,6 +4082,7 @@ elif enabled mips; then
 disable msa
 ;;
 24kec|34kc|1004kc)
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsfpu
@@ -4085,23 +4090,27 @@ elif enabled mips; then
 disable msa
 ;;
 24kef*|34kf*|1004kf*)
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsdspr2
 disable msa
 ;;
 74kc)
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsfpu
 disable msa
 ;;
 74kf)
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable msa
 ;;
 p5600)
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsdsp
@@ -4112,6 +4121,7 @@ elif enabled mips; then
 ;;
 i6400)
 disable mips32r2
+disable mips32r6
 disable mips64r2
 disable mipsdsp
 disable mipsdspr2
@@ -4123,6 +4133,7 @@ elif enabled mips; then
 loongson*)
 disable mipsfpu
 disable mips32r2
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsdsp
@@ -4154,6 +4165,7 @@ elif enabled mips; then
 *)
 disable mipsfpu
 disable mips32r2
+disable mips32r6
 disable mips64r2
 disable mips64r6
 disable mipsdsp
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 10/14] mips: put "disable mipsfpu" in a better place for loongson

2015-12-03 Thread Vicente Olivert Riera
Let's disable the ISAs first, and then the core capabilities, as we do
for the rest of the cores. This way the code is better organized.

Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Nothing.

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 5cf487a..8bd47b9 100755
--- a/configure
+++ b/configure
@@ -4131,11 +4131,11 @@ elif enabled mips; then
 add_asflags "-mfp64"
 ;;
 loongson*)
-disable mipsfpu
 disable mips32r2
 disable mips32r6
 disable mips64r2
 disable mips64r6
+disable mipsfpu
 disable mipsdsp
 disable mipsdspr2
 disable msa
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 12/14] mips: improve detection of ISAs, FPU and ASEs (DSP, MSA)

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Add a block of code for mipsdspr2 which was previously placed in the
   first patch of this series causing a syntax error in the configure
   script.
   https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183444.html

 configure | 83 +--
 1 file changed, 65 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index 2ee10db..7d06494 100755
--- a/configure
+++ b/configure
@@ -4964,27 +4964,74 @@ elif enabled mips; then
 enabled mmi && check_inline_asm mmi '"punpcklhw $f0, $f0, $f0"'
 
 # Enable minimum ISA based on selected options
-if enabled mips64 && (enabled mipsdsp || enabled mipsdspr2); then
-add_cflags "-mips64r2"
-add_asflags "-mips64r2"
-elif enabled mips64 && enabled mipsfpu && disabled loongson2 && disabled 
loongson3; then
-add_cflags "-mips64"
-add_asflags "-mips64"
-elif enabled mipsdsp || enabled mipsdspr2; then
-add_cflags "-mips32r2 -mfp32"
-add_asflags "-mips32r2 -mfp32"
+if enabled mips64; then
+if enabled mips64r6; then
+check_cflags "-mips64r6" &&
+check_ldflags "-mips64r6" &&
+add_asflags "-mips64r6" &&
+check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"'
+elif enabled mips64r2; then
+check_cflags "-mips64r2" &&
+check_ldflags "-mips64r2" &&
+add_asflags "-mips64r2" &&
+check_inline_asm mips64r2 '"dext $0, $0, 0, 1"'
+else
+check_cflags "-mips64" &&
+check_ldflags "-mips64" &&
+add_asflags "-mips64" &&
+check_inline_asm mips64r1 '"daddi $0, $0, 0"'
+fi
+else
+if enabled mips32r6; then
+check_cflags "-mips32r6" &&
+check_ldflags "-mips32r6" &&
+add_asflags "-mips32r6" &&
+check_inline_asm mips32r6 '"aui $0, $0, 0"'
+elif enabled mips32r2; then
+check_cflags "-mips32r2" &&
+check_ldflags "-mips32r2" &&
+add_asflags "-mips32r2" &&
+check_inline_asm mips32r2 '"ext $0, $0, 0, 1"'
+else
+check_cflags "-mips32" &&
+check_ldflags "-mips32" &&
+add_asflags "-mips32" &&
+check_inline_asm mips32r1 '"addi $0, $0, 0"'
+fi
+fi
+
+# MIPS FPU
+if enabled mipsfpu; then
+add_cflags "-mhard-float" &&
+add_asflags "-mhard-float" &&
+check_inline_asm mipsfpu '"cvt.d.l $f0, $f2"'
 fi
 
-enabled mipsdsp && add_cflags "-mdsp" && add_asflags "-mdsp" &&
- check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"'
-enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
- check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
-enabled mipsfpu   && add_cflags "-mhard-float" && add_asflags 
"-mhard-float" &&
- check_inline_asm mipsfpu   '"madd.d $f0, $f2, $f4, $f6"'
-enabled msa   && check_cflags "-mmsa" && check_ldflags "-mmsa" &&
- check_inline_asm msa   '"addvi.b $w0, $w1, 1"'
+# MSA and DSP support require ISA revision level 2 or greater
+if enabled mips32r2 || enabled mips64r2 || enabled mips32r6 || enabled 
mips64r6; then
+# MSA must be used with -mfp64 and -mhard-float
+if enabled mipsfpu; then
+if enabled msa; then
+check_cflags "-mfp64 -mmsa" &&
+check_ldflags "-mfp64 -mmsa" &&
+add_asflags "-mfp64 -mmsa" &&
+check_inline_asm msa '"addvi.b $w0, $w1, 1"'
+fi
+else
+disable msa
+fi
 
-enabled msa && add_asflags "-mmsa"
+if enabled mipsdsp; then
+check_cflags "-mdsp" &&
+add_asflags "-mdsp" &&
+check_inline_asm mipsdsp '"addu.qb $t0, $t1, $t2"'
+fi
+if enabled mipsdspr2; then
+check_cflags "-mdspr2" &&
+add_asflags "-mdspr2" &&
+check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
+fi
+fi
 
 elif enabled parisc; then
 
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 14/14] mips: display a warning message when using an unknown CPU

2015-12-03 Thread Vicente Olivert Riera
Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - This patch has been added for v3.

Changes v1 -> v2:
 - This patch didn't exist at that point.

 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 7d06494..62a5452 100755
--- a/configure
+++ b/configure
@@ -4163,6 +4163,8 @@ elif enabled mips; then
 # the unwanted features.
 ;;
 *)
+# Unknown CPU. Disable everything.
+echo "Warning: unknown CPU. All features disabled by default."
 disable mipsfpu
 disable mips32r2
 disable mips32r6
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 11/14] mips: do not disable any feature for generic cores

2015-12-03 Thread Vicente Olivert Riera
We don't know which features are available when the user selects a
generic core, so let's don't disable anything by default and let the
user decide.

Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Change the logic of this patch. Instead of removing the generic core,
   do not disable any feature and add a warning message to state that.
   The patch subject has also changed accordingly.

Changes v1 -> v2:
 - Nothing.

 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 8bd47b9..2ee10db 100755
--- a/configure
+++ b/configure
@@ -4159,8 +4159,8 @@ elif enabled mips; then
 esac
 ;;
 generic)
-disable mips64r6
-disable msa
+# We do not disable anything. Is up to the user to disable
+# the unwanted features.
 ;;
 *)
 disable mipsfpu
-- 
2.4.10

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


[FFmpeg-devel] [PATCH v3 13/14] mips: add support for R6

2015-12-03 Thread Vicente Olivert Riera
Understanding the mips32r6 and mips64r6 ISAs in the configure script is
not enough. In order to have full support for MIPS R6 in FFmpeg we need
to be able to build it, and for that we need to make sure we don't use
incompatible assembler code which makes the build fail. Ifdefing the
offending code is sufficient to fix the problem.

Signed-off-by: Vicente Olivert Riera 
---
Changes v2 -> v3:
 - Nothing.

Changes v1 -> v2:
 - Nothing.

 libavcodec/mips/aaccoder_mips.c   |  4 
 libavcodec/mips/aacdec_mips.h |  2 ++
 libavcodec/mips/aacpsdsp_mips.c   |  4 
 libavcodec/mips/aacpsy_mips.h |  2 ++
 libavcodec/mips/aacsbr_mips.c |  4 
 libavcodec/mips/aacsbr_mips.h |  2 ++
 libavcodec/mips/ac3dsp_mips.c |  6 +-
 libavcodec/mips/acelp_filters_mips.c  |  4 
 libavcodec/mips/acelp_vectors_mips.c  |  4 
 libavcodec/mips/amrwbdec_mips.c   |  2 ++
 libavcodec/mips/amrwbdec_mips.h   |  2 ++
 libavcodec/mips/celp_filters_mips.c   |  4 
 libavcodec/mips/celp_math_mips.c  |  4 
 libavcodec/mips/compute_antialias_float.h |  2 ++
 libavcodec/mips/fft_mips.c|  4 
 libavcodec/mips/iirfilter_mips.c  |  4 
 libavcodec/mips/lsp_mips.h|  2 ++
 libavcodec/mips/mpegaudiodsp_mips_fixed.c | 10 ++
 libavcodec/mips/mpegaudiodsp_mips_float.c | 10 ++
 libavcodec/mips/sbrdsp_mips.c |  4 
 libavutil/mips/float_dsp_mips.c   |  4 
 21 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c
index 04b3dca..3ebd776 100644
--- a/libavcodec/mips/aaccoder_mips.c
+++ b/libavcodec/mips/aaccoder_mips.c
@@ -66,6 +66,7 @@
 #include "libavcodec/aacenc_utils.h"
 
 #if HAVE_INLINE_ASM
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 typedef struct BandCodingPath {
 int prev_idx;
 float cost;
@@ -2474,10 +2475,12 @@ static void search_for_ms_mips(AACEncContext *s, 
ChannelElement *cpe)
 
 #include "libavcodec/aaccoder_trellis.h"
 
+#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
 #endif /* HAVE_INLINE_ASM */
 
 void ff_aac_coder_init_mips(AACEncContext *c) {
 #if HAVE_INLINE_ASM
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 AACCoefficientsEncoder *e = c->coder;
 int option = c->options.coder;
 
@@ -2491,5 +2494,6 @@ void ff_aac_coder_init_mips(AACEncContext *c) {
 #if HAVE_MIPSFPU
 e->search_for_ms= search_for_ms_mips;
 #endif /* HAVE_MIPSFPU */
+#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
 #endif /* HAVE_INLINE_ASM */
 }
diff --git a/libavcodec/mips/aacdec_mips.h b/libavcodec/mips/aacdec_mips.h
index 054a9fb..0c2b243 100644
--- a/libavcodec/mips/aacdec_mips.h
+++ b/libavcodec/mips/aacdec_mips.h
@@ -61,6 +61,7 @@
 #include "libavutil/mips/asmdefs.h"
 
 #if HAVE_INLINE_ASM && HAVE_MIPSFPU
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 static inline float *VMUL2_mips(float *dst, const float *v, unsigned idx,
const float *scale)
 {
@@ -246,6 +247,7 @@ static inline float *VMUL4S_mips(float *dst, const float 
*v, unsigned idx,
 #define VMUL4 VMUL4_mips
 #define VMUL2S VMUL2S_mips
 #define VMUL4S VMUL4S_mips
+#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
 #endif /* HAVE_INLINE_ASM && HAVE_MIPSFPU */
 
 #endif /* AVCODEC_MIPS_AACDEC_FLOAT_H */
diff --git a/libavcodec/mips/aacpsdsp_mips.c b/libavcodec/mips/aacpsdsp_mips.c
index 695f9ef..83fdc2f 100644
--- a/libavcodec/mips/aacpsdsp_mips.c
+++ b/libavcodec/mips/aacpsdsp_mips.c
@@ -188,6 +188,7 @@ static void ps_hybrid_synthesis_deint_mips(float 
out[2][38][64],
 }
 
 #if HAVE_MIPSFPU
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 static void ps_add_squares_mips(float *dst, const float (*src)[2], int n)
 {
 int i;
@@ -442,6 +443,7 @@ static void ps_stereo_interpolate_mips(float (*l)[2], float 
(*r)[2],
 : "memory"
 );
 }
+#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
 #endif /* HAVE_MIPSFPU */
 #endif /* HAVE_INLINE_ASM */
 
@@ -451,10 +453,12 @@ void ff_psdsp_init_mips(PSDSPContext *s)
 s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_mips;
 s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_mips;
 #if HAVE_MIPSFPU
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 s->add_squares= ps_add_squares_mips;
 s->mul_pair_single= ps_mul_pair_single_mips;
 s->decorrelate= ps_decorrelate_mips;
 s->stereo_interpolate[0]  = ps_stereo_interpolate_mips;
+#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
 #endif /* HAVE_MIPSFPU */
 #endif /* HAVE_INLINE_ASM */
 }
diff --git a/libavcodec/mips/aacpsy_mips.h b/libavcodec/mips/aacpsy_mips.h
index 42ff442..a1fe5cc 100644
--- a/libavcodec/mips/aacpsy_mips.h
+++ b/libavcodec/mips/aacpsy_mips.h
@@ -59,6 +59,7 @@
 #include "libavutil/mips/asmdefs.h"
 
 #if HAVE_INLINE_ASM && HAVE_MIPSFPU && ( PSY_LAME_FIR_LEN == 21 )
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 static void calc_thr_3gpp_mips(const FFPsyWi

Re: [FFmpeg-devel] [PATCH v3 11/14] mips: do not disable any feature for generic cores

2015-12-03 Thread Vicente Olivert Riera
Hello all,

On 03/12/15 13:22, Vicente Olivert Riera wrote:
> We don't know which features are available when the user selects a
> generic core, so let's don't disable anything by default and let the
> user decide.
> 
> Signed-off-by: Vicente Olivert Riera 
> ---
> Changes v2 -> v3:
>  - Change the logic of this patch. Instead of removing the generic core,
>do not disable any feature ** and add a warning message to state that. **

I shouldn't have written that in the "Changes". There is no warning
message. I was thinking in another patch. Ignore that sentence.

Regards,

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


Re: [FFmpeg-devel] [PATCH 2/2] ffmdec: reject zero-sized chunks

2015-12-03 Thread Michael Niedermayer
On Wed, Dec 02, 2015 at 11:13:44PM +0100, Andreas Cadhalpun wrote:
> If size is zero, avio_get_str fails, leaving the buffer uninitialized.
> This causes invalid reads in av_set_options_string.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavformat/ffmdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM

thx


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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


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


Re: [FFmpeg-devel] [PATCH 1/2] ffmdec: only seek back at EOF if a server is attached

2015-12-03 Thread Michael Niedermayer
On Wed, Dec 02, 2015 at 11:13:14PM +0100, Andreas Cadhalpun wrote:
> Otherwise the ffm demuxer can return the same packets endlessly, if
> there is no server attached.
> ---
> 
> I haven't tested ffserver, but since it sets server_attached, it
> should still work as previously.

probably ok

thx

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

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


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


Re: [FFmpeg-devel] [PATCH] mjpegdec: consider chroma subsampling in size check

2015-12-03 Thread Michael Niedermayer
On Wed, Dec 02, 2015 at 10:00:13PM +0100, Andreas Cadhalpun wrote:
> If the chroma components are subsampled, smaller buffers are allocated
> for them. In that case the maximal block_offset for the chroma
> components is not as large as for the luma component.
> 
> This fixes out of bounds writes causing segmentation faults or memory
> corruption.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/mjpegdec.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)



> 
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index cfc59ac..303b990 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -1246,7 +1246,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int 
> nb_components, int Ah,
>   int mb_bitmask_size,
>   const AVFrame *reference)
>  {
> -int i, mb_x, mb_y;
> +int i, mb_x, mb_y, chroma_h_shift, chroma_v_shift;
>  uint8_t *data[MAX_COMPONENTS];
>  const uint8_t *reference_data[MAX_COMPONENTS];
>  int linesize[MAX_COMPONENTS];
> @@ -1271,6 +1271,9 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int 
> nb_components, int Ah,
>  s->coefs_finished[c] |= 1;
>  }
>  
> +av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &chroma_h_shift,
> + &chroma_v_shift);
> +
>  for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
>  for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
>  const int copy_mb = mb_bitmask && !get_bits1(&mb_bitmask_gb);
> @@ -1285,7 +1288,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int 
> nb_components, int Ah,
>  }
>  for (i = 0; i < nb_components; i++) {
>  uint8_t *ptr;
> -int n, h, v, x, y, c, j;
> +int n, h, v, x, y, c, j, h_shift, v_shift;
>  int block_offset;
>  n = s->nb_blocks[i];
>  c = s->comp_index[i];
> @@ -1293,14 +1296,16 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, 
> int nb_components, int Ah,
>  v = s->v_scount[i];
>  x = 0;
>  y = 0;
> +h_shift = c ? chroma_h_shift: 0;
> +v_shift = c ? chroma_v_shift: 0;
>  for (j = 0; j < n; j++) {
>  block_offset = (((linesize[c] * (v * mb_y + y) * 8) +
>   (h * mb_x + x) * 8 * bytes_per_pixel) 
> >> s->avctx->lowres);
>  
>  if (s->interlaced && s->bottom_field)
>  block_offset += linesize[c] >> 1;
> -if (   8*(h * mb_x + x) < s->width
> -&& 8*(v * mb_y + y) < s->height) {
> +if (   8*(h * mb_x + x) < (s->width  + (1 << h_shift) - 
> 1) >> h_shift
> +&& 8*(v * mb_y + y) < (s->height + (1 << v_shift) - 
> 1) >> v_shift) {

please move the w/h computation out of the block loop
it stays the same for a component and does not need to be
recalculated
theres a loop above that fills data[] that can probably be used to
fill w/h arrays

also is this not also needed in mjpeg_decode_scan_progressive_ac() ?

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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


Re: [FFmpeg-devel] [PATCH 1/2] vp9: add hwaccel hooks

2015-12-03 Thread Ronald S. Bultje
Hi,

On Thu, Dec 3, 2015 at 6:13 AM, Hendrik Leppkes  wrote:

> On Thu, Dec 3, 2015 at 11:13 AM, Hendrik Leppkes 
> wrote:
> > ---
> >  libavcodec/vp9.c | 128
> +++
> >  libavcodec/vp9.h |   3 ++
> >  2 files changed, 94 insertions(+), 37 deletions(-)
> >
> > diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> > index dc0..87e80d8 100644
> > --- a/libavcodec/vp9.c
> > +++ b/libavcodec/vp9.c
> > @@ -168,6 +168,15 @@ static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
> >  }
> >  };
> >
> > +static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> > +{
> > +ff_thread_release_buffer(ctx, &f->tf);
> > +av_buffer_unref(&f->extradata);
> > +av_buffer_unref(&f->hwaccel_priv_buf);
> > +f->segmentation_map = NULL;
> > +f->hwaccel_picture_private = NULL;
> > +}
> > +
> >  static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
> >  {
> >  VP9Context *s = ctx->priv_data;
> > @@ -177,21 +186,28 @@ static int vp9_alloc_frame(AVCodecContext *ctx,
> VP9Frame *f)
> >  return ret;
> >  sz = 64 * s->sb_cols * s->sb_rows;
> >  if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct
> VP9mvrefPair) {
> > -ff_thread_release_buffer(ctx, &f->tf);
> > -return AVERROR(ENOMEM);
> > +goto fail;
> >  }
> >
> >  f->segmentation_map = f->extradata->data;
> >  f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
> >
> > +if (ctx->hwaccel) {
> > +const AVHWAccel *hwaccel = ctx->hwaccel;
> > +av_assert0(!f->hwaccel_picture_private);
> > +if (hwaccel->frame_priv_data_size) {
> > +f->hwaccel_priv_buf =
> av_buffer_allocz(hwaccel->frame_priv_data_size);
> > +if (!f->hwaccel_priv_buf)
> > +goto fail;
> > +f->hwaccel_picture_private = f->hwaccel_priv_buf->data;
> > +}
> > +}
> > +
> >  return 0;
> > -}
> >
> > -static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
> > -{
> > -ff_thread_release_buffer(ctx, &f->tf);
> > -av_buffer_unref(&f->extradata);
> > -f->segmentation_map = NULL;
> > +fail:
> > +vp9_unref_frame(ctx, f);
> > +return AVERROR(ENOMEM);
> >  }
> >
> >  static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame
> *src)
> > @@ -201,19 +217,31 @@ static int vp9_ref_frame(AVCodecContext *ctx,
> VP9Frame *dst, VP9Frame *src)
> >  if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
> >  return res;
> >  } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
> > -vp9_unref_frame(ctx, dst);
> > -return AVERROR(ENOMEM);
> > +goto fail;
> >  }
> >
> >  dst->segmentation_map = src->segmentation_map;
> >  dst->mv = src->mv;
> >  dst->uses_2pass = src->uses_2pass;
> >
> > +if (src->hwaccel_picture_private) {
> > +dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
> > +if (!dst->hwaccel_priv_buf)
> > +goto fail;
> > +dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data;
> > +}
> > +
> >  return 0;
> > +
> > +fail:
> > +vp9_unref_frame(ctx, dst);
> > +return AVERROR(ENOMEM);
> >  }
> >
> >  static int update_size(AVCodecContext *ctx, int w, int h)
> >  {
> > +#define HWACCEL_MAX (0)
> > +enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
> >  VP9Context *s = ctx->priv_data;
> >  uint8_t *p;
> >  int bytesperpixel = s->bytesperpixel, res;
> > @@ -225,7 +253,16 @@ static int update_size(AVCodecContext *ctx, int w,
> int h)
> >
> >  if ((res = ff_set_dimensions(ctx, w, h)) < 0)
> >  return res;
> > -s->last_fmt  = ctx->pix_fmt = s->pix_fmt;
> > +s->last_fmt  = s->pix_fmt;
> > +
> > +*fmtp++ = s->pix_fmt;
> > +*fmtp = AV_PIX_FMT_NONE;
> > +
> > +res = ff_thread_get_format(ctx, pix_fmts);
> > +if (res < 0)
> > +return res;
> > +
> > +ctx->pix_fmt = res;
>
> I should probably move setting s->last_fmt below the get_format call
> to avoid re-introducing the bug of state de-syncing when some other
> error occured.


The state is in s->pix_fmt, not s->last_fmt. s->last_fmt is just "the
previous state" to compare the current state to. If your point is that the
state may be "nothing" on failure, then maybe we should set s->last_fmt to
AV_PIX_FMT_NONE on error (and on init) to make sure it is reinit'ed again...

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


Re: [FFmpeg-devel] [PATCH] vp9: add hwaccel hooks

2015-12-03 Thread Ronald S. Bultje
Hi,

On Thu, Dec 3, 2015 at 4:55 AM, Hendrik Leppkes  wrote:

> +if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
>
+#if CONFIG_VP9_DXVA2_HWACCEL
> +*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
> +#endif
> +#if CONFIG_VP9_D3D11VA_HWACCEL
> +*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
> +#endif
> +}


So ... this suggests that hwaccels will ever only support 420, 8bpp. That
may currently be true, but is that likely to hold forever? What happens if
we just do this regardless of pixfmt and let the hwaccel figure out if the
hw supports 420 or something else?

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


Re: [FFmpeg-devel] [PATCH] vp9: add hwaccel hooks

2015-12-03 Thread Hendrik Leppkes
On Thu, Dec 3, 2015 at 5:21 PM, Ronald S. Bultje  wrote:
> Hi,
>
> On Thu, Dec 3, 2015 at 4:55 AM, Hendrik Leppkes  wrote:
>
>> +if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
>>
> +#if CONFIG_VP9_DXVA2_HWACCEL
>> +*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
>> +#endif
>> +#if CONFIG_VP9_D3D11VA_HWACCEL
>> +*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
>> +#endif
>> +}
>
>
> So ... this suggests that hwaccels will ever only support 420, 8bpp. That
> may currently be true, but is that likely to hold forever? What happens if
> we just do this regardless of pixfmt and let the hwaccel figure out if the
> hw supports 420 or something else?
>

At the very least the DXVA2 hwaccel spec is limited to profile 0, so
maybe it should even check the profile on top of this.
In general, there is some disagreement if other chroma formats should
use other hwaccel pixfmts, as the calling code can otherwise get
confused, as it may need special handling to handle other chroma
formats. However, since no hwaccel supports anything else yet (except
hevc, which can do 420 10-bit, but I didn't push that to ffmpeg yet),
it was not a real problem yet.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] mpegencts: Fix overflow in cbr mode period calculations

2015-12-03 Thread Michael Niedermayer
On Sat, Nov 28, 2015 at 08:27:39AM +0200, Timo Teräs wrote:
> ts->mux_rate is int (signed 32-bit) type. The period calculations
> will start to overflow when mux_rate > 5mbps. This fixes overflows
> by converting first to 64-bit type.
> 
> Fixes #5044.
> 
> Signed-off-by: Timo Teräs 
> ---
> Seems av_rescale() was a bit overkill, and specifying the rounding
> mode made the code uglier.. So I just added an explicit cast now.

applied

thanks

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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


Re: [FFmpeg-devel] [PATCH] vp9: add hwaccel hooks

2015-12-03 Thread Ronald S. Bultje
Hi,

On Thu, Dec 3, 2015 at 11:29 AM, Hendrik Leppkes 
wrote:

> On Thu, Dec 3, 2015 at 5:21 PM, Ronald S. Bultje 
> wrote:
> > Hi,
> >
> > On Thu, Dec 3, 2015 at 4:55 AM, Hendrik Leppkes 
> wrote:
> >
> >> +if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
> >>
> > +#if CONFIG_VP9_DXVA2_HWACCEL
> >> +*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
> >> +#endif
> >> +#if CONFIG_VP9_D3D11VA_HWACCEL
> >> +*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
> >> +#endif
> >> +}
> >
> >
> > So ... this suggests that hwaccels will ever only support 420, 8bpp. That
> > may currently be true, but is that likely to hold forever? What happens
> if
> > we just do this regardless of pixfmt and let the hwaccel figure out if
> the
> > hw supports 420 or something else?
> >
>
> At the very least the DXVA2 hwaccel spec is limited to profile 0, so
> maybe it should even check the profile on top of this.
> In general, there is some disagreement if other chroma formats should
> use other hwaccel pixfmts, as the calling code can otherwise get
> confused, as it may need special handling to handle other chroma
> formats. However, since no hwaccel supports anything else yet (except
> hevc, which can do 420 10-bit, but I didn't push that to ffmpeg yet),
> it was not a real problem yet.


I'm ok with deferring it until such hardware comes along I guess, so
consider the comment ignorable...

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


Re: [FFmpeg-devel] [PATCH] aacenc: mark coders other than twoloop as experimental

2015-12-03 Thread Rostislav Pehlivanov
Any opposition?

On 2 December 2015 at 19:47, Rostislav Pehlivanov 
wrote:

> This commit marks any coders beside twoloop as experimental and gives
> out a warning that some of they might be silently removed in the future.
>
> Users are highly encouraged to use the twoloop coder, which is the
> default.
> ---
>  libavcodec/aacenc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
> index 971f8ab..7a34806 100644
> --- a/libavcodec/aacenc.c
> +++ b/libavcodec/aacenc.c
> @@ -967,6 +967,8 @@ static av_cold int aac_encode_init(AVCodecContext
> *avctx)
>  s->coder = &ff_aac_coders[s->options.coder];
>
>  if (s->options.coder != AAC_CODER_TWOLOOP) {
> +ERROR_IF(avctx->strict_std_compliance >
> FF_COMPLIANCE_EXPERIMENTAL,
> + "Coders other than twoloop require -strict -2 and some
> may be removed in the future\n");
>  s->options.intensity_stereo = 0;
>  s->options.pns = 0;
>  }
> --
> 2.6.2
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/5] lavf/flvdec: use FFERROR_REDO instead of AVERROR(EAGAIN).

2015-12-03 Thread Nicolas George
Le tridi 13 frimaire, an CCXXIV, Stefano Sabatini a écrit :
> LGTM.

Thanks everyone, series pushed.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 4/5] lavfi: replace link.closed by link.status.

2015-12-03 Thread Nicolas George
Le decadi 10 frimaire, an CCXXIV, Michael Niedermayer a écrit :
> this should mention in which timebase the pts is and possibly
> relative to what the timestamp is
> its rather obvious to write
> AVERROR(ENOMEM)
> pts = av_gettime()
> based on this documentation

Changed to this:

/**
 * Set the status field of a link from the source filter.
 * The pts should reflect the timestamp of the status change,
 * in link time base and relative to the frames timeline.
 * In particular, for AVERROR_EOF, it should reflect the
 * end time of the last frame.
 */

> s/unset/AV_NOPTS_VALUE/ ?

Changed to:

 * The pts should probably be left unset (AV_NOPTS_VALUE).

> rest of this patch LGTM, no need to resubmit for just above things
> if there are no other reasons to do so

Thanks for the review.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 3/5] lavfi: deprecate avfilter_link_set_closed().

2015-12-03 Thread Nicolas George
Le duodi 12 frimaire, an CCXXIV, Andreas Cadhalpun a écrit :
> It would be nice to mention this deprecation in APIchanges.
> Other than that, this deprecation should be fine, as there seem to be no users
> of this function.

Added this:

2015-XX-XX - xxx - lavfi 6.19.101 - avfilter.h
  Deprecate avfilter_link_set_closed().
  Applications are not supposed to mess with links,
  they should close the sinks.

and micro bump.

Also fixed the typo in patch 5/5 commit message.

Will push the series soon if nobody objects and start working on the next
step.

Thanks everybody for the reviews.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] aacenc: mark coders other than twoloop as experimental

2015-12-03 Thread Claudio Freire
On Thu, Dec 3, 2015 at 3:01 PM, Rostislav Pehlivanov
 wrote:
> Any opposition?


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


Re: [FFmpeg-devel] [PATCH] vp9: add hwaccel hooks

2015-12-03 Thread Hendrik Leppkes
On Thu, Dec 3, 2015 at 6:17 PM, Ronald S. Bultje  wrote:
> Hi,
>
> On Thu, Dec 3, 2015 at 11:29 AM, Hendrik Leppkes 
> wrote:
>
>> On Thu, Dec 3, 2015 at 5:21 PM, Ronald S. Bultje 
>> wrote:
>> > Hi,
>> >
>> > On Thu, Dec 3, 2015 at 4:55 AM, Hendrik Leppkes 
>> wrote:
>> >
>> >> +if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
>> >>
>> > +#if CONFIG_VP9_DXVA2_HWACCEL
>> >> +*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
>> >> +#endif
>> >> +#if CONFIG_VP9_D3D11VA_HWACCEL
>> >> +*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
>> >> +#endif
>> >> +}
>> >
>> >
>> > So ... this suggests that hwaccels will ever only support 420, 8bpp. That
>> > may currently be true, but is that likely to hold forever? What happens
>> if
>> > we just do this regardless of pixfmt and let the hwaccel figure out if
>> the
>> > hw supports 420 or something else?
>> >
>>
>> At the very least the DXVA2 hwaccel spec is limited to profile 0, so
>> maybe it should even check the profile on top of this.
>> In general, there is some disagreement if other chroma formats should
>> use other hwaccel pixfmts, as the calling code can otherwise get
>> confused, as it may need special handling to handle other chroma
>> formats. However, since no hwaccel supports anything else yet (except
>> hevc, which can do 420 10-bit, but I didn't push that to ffmpeg yet),
>> it was not a real problem yet.
>
>
> I'm ok with deferring it until such hardware comes along I guess, so
> consider the comment ignorable...
>

Any comments on the vp9 changes themself? :)

Most of the changes are not very invasive, just some extra allocations
and error handling, the default hwaccel hooks, and whatnot.
I moved the reference frame check down as we discussed on IRC the
other day, so that it can happen after the decoder has been switched
into or out of HWAccel mode.

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


[FFmpeg-devel] [PATCH] mpegtsenc: Fix off-by-one in indexing into Opus channel mapping arrays

2015-12-03 Thread Sebastian Dröge
From: Sebastian Dröge 

---
 libavformat/mpegtsenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 8591e8c..27cd89f 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -401,11 +401,11 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 
 if (st->codec->extradata[19] == st->codec->channels - 
coupled_stream_counts[st->codec->channels] &&
 st->codec->extradata[20] == 
coupled_stream_counts[st->codec->channels] &&
-memcmp(&st->codec->extradata[21], 
channel_map_a[st->codec->channels], st->codec->channels) == 0) {
+memcmp(&st->codec->extradata[21], 
channel_map_a[st->codec->channels-1], st->codec->channels) == 0) {
 *q++ = st->codec->channels;
 } else if (st->codec->channels >= 2 && 
st->codec->extradata[19] == st->codec->channels &&
st->codec->extradata[20] == 0 &&
-   memcmp(&st->codec->extradata[21], 
channel_map_b[st->codec->channels], st->codec->channels) == 0) {
+   memcmp(&st->codec->extradata[21], 
channel_map_b[st->codec->channels-1], st->codec->channels) == 0) {
 *q++ = st->codec->channels | 0x80;
 } else {
 /* Unsupported, could write an extended descriptor 
here */
-- 
2.6.2

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


[FFmpeg-devel] [PATCH] avcodec/golomb: Mask shift amount before use in get_ue_golomb()

2015-12-03 Thread Michael Niedermayer
From: Michael Niedermayer 

Fixes undefined behavior
Fixes: mozilla bug 1229208
Fixes: 
fbeb8b2c7c996e9b91c6b1af319d7ebc/asan_heap-oob_195450f_2743_e8856ece4579ea486670be2b236099a0.bit

Found-by: Tyson Smith
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer 
---
 libavcodec/golomb.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index d30bb6b..323665d 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -72,7 +72,7 @@ static inline int get_ue_golomb(GetBitContext *gb)
 av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n");
 return AVERROR_INVALIDDATA;
 }
-buf >>= log;
+buf >>= log & 31;
 buf--;
 
 return buf;
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH] aacenc_ltp: attempt to appease Coverity

2015-12-03 Thread Rostislav Pehlivanov
Coverity is reporting an out of bounds here even though there shouldn't
be one. Attempt to apply some stylistic dithering to make it stop.
---
 libavcodec/aacenc_ltp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aacenc_ltp.c b/libavcodec/aacenc_ltp.c
index e19f3cc..0f449de 100644
--- a/libavcodec/aacenc_ltp.c
+++ b/libavcodec/aacenc_ltp.c
@@ -167,7 +167,7 @@ void ff_aac_search_for_ltp(AACEncContext *s, 
SingleChannelElement *sce,
 
 if (sce->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
 if (sce->ics.ltp.lag) {
-memset(&sce->lcoeffs[0], 0.0f, 3072*sizeof(sce->lcoeffs[0]));
+memset(sce->lcoeffs, 0, 3072*sizeof(sce->lcoeffs[0]));
 memset(&sce->ics.ltp, 0, sizeof(LongTermPrediction));
 }
 return;
-- 
2.6.2

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


[FFmpeg-devel] [PATCH] avfilter: add panorama filter

2015-12-03 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_panorama.c | 304 ++
 3 files changed, 306 insertions(+)
 create mode 100644 libavfilter/vf_panorama.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 740a640..36ade75 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -192,6 +192,7 @@ OBJS-$(CONFIG_OWDENOISE_FILTER)  += 
vf_owdenoise.o
 OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
 OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o
 OBJS-$(CONFIG_PALETTEUSE_FILTER) += vf_paletteuse.o dualinput.o 
framesync.o
+OBJS-$(CONFIG_PANORAMA_FILTER)   += vf_panorama.o
 OBJS-$(CONFIG_PERMS_FILTER)  += f_perms.o
 OBJS-$(CONFIG_PERSPECTIVE_FILTER)+= vf_perspective.o
 OBJS-$(CONFIG_PHASE_FILTER)  += vf_phase.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 6557612..c2ea7e5 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -213,6 +213,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(PAD,pad,vf);
 REGISTER_FILTER(PALETTEGEN, palettegen, vf);
 REGISTER_FILTER(PALETTEUSE, paletteuse, vf);
+REGISTER_FILTER(PANORAMA,   panorama,   vf);
 REGISTER_FILTER(PERMS,  perms,  vf);
 REGISTER_FILTER(PERSPECTIVE,perspective,vf);
 REGISTER_FILTER(PHASE,  phase,  vf);
diff --git a/libavfilter/vf_panorama.c b/libavfilter/vf_panorama.c
new file mode 100644
index 000..4cc0831
--- /dev/null
+++ b/libavfilter/vf_panorama.c
@@ -0,0 +1,304 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/eval.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+enum Projections {
+EQUIRECTANGULAR,
+CUBIC,
+NB_PROJECTIONS,
+};
+
+struct XYRemap {
+int vi, ui;
+int v2, u2;
+float a, b, c, d;
+};
+
+typedef struct PanoramaContext {
+const AVClass *class;
+int in, out;
+
+int planewidth[4], planeheight[4];
+int inplanewidth[4], inplaneheight[4];
+int nb_planes;
+
+struct XYRemap *remap[4];
+int (*panorama)(struct PanoramaContext *s,
+const uint8_t *src, uint8_t *dst,
+int width, int height,
+int in_width, int in_height,
+int in_linesize, int out_linesize,
+struct XYRemap *remap);
+} PanoramaContext;
+
+#define OFFSET(x) offsetof(PanoramaContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+static const AVOption panorama_options[] = {
+{ "i", "set input projection",  OFFSET(in),  AV_OPT_TYPE_INT, 
{.i64=EQUIRECTANGULAR}, 0, NB_PROJECTIONS-1, FLAGS },
+{ "o", "set output projection", OFFSET(out), AV_OPT_TYPE_INT, 
{.i64=CUBIC},   0, NB_PROJECTIONS-1, FLAGS },
+{ NULL }
+};
+
+AVFILTER_DEFINE_CLASS(panorama);
+
+static int query_formats(AVFilterContext *ctx)
+{
+static const enum AVPixelFormat pix_fmts[] = {
+AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
+AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, 
AV_PIX_FMT_YUVJ422P,AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ411P,
+AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV422P, 
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
+AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
+};
+
+AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
+if (!fmts_list)
+return AVERROR(ENOMEM);
+return ff_set_common_formats(ctx, fmts_list);
+}
+
+static void to_xyz(int i, int j, int face, float edge, float *x, float *y, 
float *z)
+{
+float a = 2.0 * i / edge;
+float b = 2.0 * j / edge;
+
+if (face == 0) { // back
+*x = -1.0;
+*y = 1.0 - a;
+*z = 3.0 - b;
+} else if (face == 1) { // left
+*x = a - 3.0;
+*y = -1.0;
+*z = 3.0 - b;
+} else if (face == 2) { //

Re: [FFmpeg-devel] [PATCH] aacenc_ltp: attempt to appease Coverity

2015-12-03 Thread Hendrik Leppkes
On Thu, Dec 3, 2015 at 11:31 PM, Rostislav Pehlivanov
 wrote:
> Coverity is reporting an out of bounds here even though there shouldn't
> be one. Attempt to apply some stylistic dithering to make it stop.
> ---
>  libavcodec/aacenc_ltp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/aacenc_ltp.c b/libavcodec/aacenc_ltp.c
> index e19f3cc..0f449de 100644
> --- a/libavcodec/aacenc_ltp.c
> +++ b/libavcodec/aacenc_ltp.c
> @@ -167,7 +167,7 @@ void ff_aac_search_for_ltp(AACEncContext *s, 
> SingleChannelElement *sce,
>
>  if (sce->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
>  if (sce->ics.ltp.lag) {
> -memset(&sce->lcoeffs[0], 0.0f, 3072*sizeof(sce->lcoeffs[0]));
> +memset(sce->lcoeffs, 0, 3072*sizeof(sce->lcoeffs[0]));
>  memset(&sce->ics.ltp, 0, sizeof(LongTermPrediction));
>  }
>  return;
> --

lcoeffs is only 1024 elements, so it appears coverity is right? :)

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


[FFmpeg-devel] [PATCH] avfilter: add audio emphasis filter

2015-12-03 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 Changelog  |   1 +
 configure  |  26 
 doc/filters.texi   |  46 ++
 libavfilter/Makefile   |   1 +
 libavfilter/af_aemphasis.c | 370 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/version.h  |   2 +-
 7 files changed, 446 insertions(+), 1 deletion(-)
 create mode 100644 libavfilter/af_aemphasis.c

diff --git a/Changelog b/Changelog
index 2d2a92b..552fab1 100644
--- a/Changelog
+++ b/Changelog
@@ -39,6 +39,7 @@ version :
 - support encoding 16-bit RLE SGI images
 - apulsator filter
 - sidechaingate audio filter
+- aemphasis filter
 
 
 version 2.8:
diff --git a/configure b/configure
index a30d831..10631e8 100755
--- a/configure
+++ b/configure
@@ -1051,6 +1051,21 @@ int main(void){ $func(); }
 EOF
 }
 
+check_complexfunc(){
+log check_complexfunc "$@"
+func=$1
+narg=$2
+shift 2
+test $narg = 2 && args="f, g" || args="f"
+disable $func
+check_ld "cc" "$@" <
+#include 
+float foo(complex float f, complex float g) { return $func($args); }
+int main(void){ return (int) foo; }
+EOF
+}
+
 check_mathfunc(){
 log check_mathfunc "$@"
 func=$1
@@ -1768,6 +1783,11 @@ INTRINSICS_LIST="
 intrinsics_neon
 "
 
+COMPLEX_FUNCS="
+cabs
+cexp
+"
+
 MATH_FUNCS="
 atanf
 atan2f
@@ -1903,6 +1923,7 @@ HAVE_LIST="
 $ARCH_FEATURES
 $ATOMICS_LIST
 $BUILTIN_LIST
+$COMPLEX_FUNCS
 $HAVE_LIST_CMDLINE
 $HAVE_LIST_PUB
 $HEADERS_LIST
@@ -2785,6 +2806,7 @@ unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
 
 # filters
+aemphasis_filter_deps="cabs cexp"
 amovie_filter_deps="avcodec avformat"
 aresample_filter_deps="swresample"
 ass_filter_deps="libass"
@@ -5324,6 +5346,10 @@ for func in $MATH_FUNCS; do
 eval check_mathfunc $func \${${func}_args:-1}
 done
 
+for func in $COMPLEX_FUNCS; do
+eval check_complexfunc $func \${${func}_args:-1}
+done
+
 # these are off by default, so fail if requested and not available
 enabled avfoundation_indev && { check_header_oc AVFoundation/AVFoundation.h || 
disable avfoundation_indev; }
 enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h 
CGGetActiveDisplayList -framework CoreGraphics ||
diff --git a/doc/filters.texi b/doc/filters.texi
index bf299ca..12082de 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -528,6 +528,52 @@ aecho=0.8:0.9:1000|1800:0.3|0.25
 @end example
 @end itemize
 
+@section aemphasis
+Audio emphasis filter creates or restores material directly taken from LPs or
+emphased CDs with different filter curves. E.g. to store music on vinyl the
+signal has to be altered by a filter first to even out the disadvantages of
+this recording medium.
+Once the material is played back the inverse filter has to be applied to
+restore the distortion of the frequency response.
+
+The filter accepts the following options:
+
+@table @option
+@item level_in
+Set input gain.
+
+@item level_out
+Set output gain.
+
+@item mode
+Set filter mode. For restoring material use @code{reproduction} mode, otherwise
+use @code{production} mode. Default is @code{reproduction} mode.
+
+@item type
+Set filter type. Selects medium. Can be one of the following:
+
+@table @option
+@item col
+select Columbia.
+@item emi
+select EMI.
+@item bsi
+select BSI (78RPM).
+@item riaa
+select RIAA.
+@item cd
+select Compact Disc (CD).
+@item 50fm
+select 50µs (FM).
+@item 75fm
+select 75µs (FM).
+@item 50kf
+select 50µs (FM-KF).
+@item 75kf
+select 75µs (FM-KF).
+@end table
+@end table
+
 @section aeval
 
 Modify an audio signal according to the specified expressions.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 740a640..8884d1d 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -27,6 +27,7 @@ OBJS-$(CONFIG_ACOMPRESSOR_FILTER)+= 
af_sidechaincompress.o
 OBJS-$(CONFIG_ACROSSFADE_FILTER) += af_afade.o
 OBJS-$(CONFIG_ADELAY_FILTER) += af_adelay.o
 OBJS-$(CONFIG_AECHO_FILTER)  += af_aecho.o
+OBJS-$(CONFIG_AEMPHASIS_FILTER)  += af_aemphasis.o
 OBJS-$(CONFIG_AEVAL_FILTER)  += aeval.o
 OBJS-$(CONFIG_AFADE_FILTER)  += af_afade.o
 OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c
new file mode 100644
index 000..4501858
--- /dev/null
+++ b/libavfilter/af_aemphasis.c
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2001-2010 Krzysztof Foltman, Markus Schmidt, Thor Harald 
Johansen, Damien Zammit and others
+ *
+ * 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 

[FFmpeg-devel] [PATCH] libavformat/mov.c: allow QuickTime metadata to come after traks

2015-12-03 Thread Neil Birkbeck
QuickTime metadata can come after trak data. Add indicator for which trak is 
being parsed (-1 if none) so that global metadata after the trak can be parsed.

Signed-off-by: Neil Birkbeck 
---
 libavformat/isom.h | 1 +
 libavformat/mov.c  | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index a082e40..65a64d4 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -178,6 +178,7 @@ typedef struct MOVContext {
 int found_moov;   ///< 'moov' atom has been found
 int found_mdat;   ///< 'mdat' atom has been found
 int found_hdlr_mdta;  ///< 'hdlr' atom with type 'mdta' has been found
+int trak_index;   ///< Index of the current 'trak'
 char **meta_keys;
 unsigned meta_keys_count;
 DVDemuxContext *dv_demux;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index cee037b..1f97d3e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -643,7 +643,7 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 av_log(c->fc, AV_LOG_TRACE, "ctype= %.4s (0x%08x)\n", (char*)&ctype, 
ctype);
 av_log(c->fc, AV_LOG_TRACE, "stype= %.4s\n", (char*)&type);
 
-if (c->fc->nb_streams < 1) {  // meta before first trak
+if (c->trak_index < 0) {  // meta not inside a trak
 if (type == MKTAG('m','d','t','a')) {
 c->found_hdlr_mdta = 1;
 }
@@ -3073,10 +3073,13 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 st->priv_data = sc;
 st->codec->codec_type = AVMEDIA_TYPE_DATA;
 sc->ffindex = st->index;
+c->trak_index = st->index;
 
 if ((ret = mov_read_default(c, pb, atom)) < 0)
 return ret;
 
+c->trak_index = -1;
+
 /* sanity checks */
 if (sc->chunk_count && (!sc->stts_count || !sc->stsc_count ||
 (!sc->sample_size && !sc->sample_count))) {
@@ -4617,6 +4620,7 @@ static int mov_read_header(AVFormatContext *s)
 int i;
 
 mov->fc = s;
+mov->trak_index = -1;
 /* .mov and .mp4 aren't streamable anyway (only progressive download if 
moov is before mdat) */
 if (pb->seekable)
 atom.size = avio_size(pb);
-- 
2.6.0.rc2.230.g3dd15c0

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


Re: [FFmpeg-devel] [PATCH] avfilter: add audio emphasis filter

2015-12-03 Thread Ganesh Ajjanagadde
On Thu, Dec 3, 2015 at 5:52 PM, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  Changelog  |   1 +
>  configure  |  26 
>  doc/filters.texi   |  46 ++
>  libavfilter/Makefile   |   1 +
>  libavfilter/af_aemphasis.c | 370 
> +
>  libavfilter/allfilters.c   |   1 +
>  libavfilter/version.h  |   2 +-
>  7 files changed, 446 insertions(+), 1 deletion(-)
>  create mode 100644 libavfilter/af_aemphasis.c
>
> diff --git a/Changelog b/Changelog
> index 2d2a92b..552fab1 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -39,6 +39,7 @@ version :
>  - support encoding 16-bit RLE SGI images
>  - apulsator filter
>  - sidechaingate audio filter
> +- aemphasis filter
>
>
>  version 2.8:
> diff --git a/configure b/configure
> index a30d831..10631e8 100755
> --- a/configure
> +++ b/configure
> @@ -1051,6 +1051,21 @@ int main(void){ $func(); }
>  EOF
>  }
>
> +check_complexfunc(){
> +log check_complexfunc "$@"
> +func=$1
> +narg=$2
> +shift 2
> +test $narg = 2 && args="f, g" || args="f"
> +disable $func
> +check_ld "cc" "$@" < +#include 
> +#include 
> +float foo(complex float f, complex float g) { return $func($args); }
> +int main(void){ return (int) foo; }
> +EOF
> +}
> +
>  check_mathfunc(){
>  log check_mathfunc "$@"
>  func=$1
> @@ -1768,6 +1783,11 @@ INTRINSICS_LIST="
>  intrinsics_neon
>  "
>
> +COMPLEX_FUNCS="
> +cabs
> +cexp
> +"
> +

These are not inherently needed, cabs and cexp can be easily
implemented using hypot and sin, cos, etc. See e.g the mandelbrot
filter; the filter mathematically operates on complex numbers, but one
can always use the real value variants with a trivial amount of work.

Don't know and it is unlikely that all our platforms have them - a
platform which refuses to implement simple things like llrint would
most likely not bother with this stuff. If you really want to use
complex numbers (though above demonstrates there is no inherent
reason), you should add the relevant compat hacks.

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


Re: [FFmpeg-devel] [PATCH] avcodec/golomb: Mask shift amount before use in get_ue_golomb()

2015-12-03 Thread Ganesh Ajjanagadde
On Thu, Dec 3, 2015 at 5:09 PM, Michael Niedermayer  wrote:
> From: Michael Niedermayer 
>
> Fixes undefined behavior
> Fixes: mozilla bug 1229208
> Fixes: 
> fbeb8b2c7c996e9b91c6b1af319d7ebc/asan_heap-oob_195450f_2743_e8856ece4579ea486670be2b236099a0.bit
>
> Found-by: Tyson Smith
> Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> Signed-off-by: Michael Niedermayer 

Minor comment: was this found by xiedingbao's undefined behavior
report as well? While investigating, I found some things that were
flagging the golomb code, but can't confirm that it is this one.

I don't mind at all; it may be somewhat funny if 3 people
independently came up with the same report :).

As for the technical change, seems ok but you may want a better review
as I have not done deep analysis of this.

> ---
>  libavcodec/golomb.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
> index d30bb6b..323665d 100644
> --- a/libavcodec/golomb.h
> +++ b/libavcodec/golomb.h
> @@ -72,7 +72,7 @@ static inline int get_ue_golomb(GetBitContext *gb)
>  av_log(NULL, AV_LOG_ERROR, "Invalid UE golomb code\n");
>  return AVERROR_INVALIDDATA;
>  }
> -buf >>= log;
> +buf >>= log & 31;
>  buf--;
>
>  return buf;
> --
> 1.7.9.5
>
> ___
> 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] [PATCH] avcodec/aacsbr_tablegen: always initialize tables at runtime

2015-12-03 Thread Ganesh Ajjanagadde
On Sun, Nov 29, 2015 at 10:58 PM, Ganesh Ajjanagadde
 wrote:
> This gets rid of virtually useless hardcoded tables hackery. The reason
> it is useless is that a 320 element lut is anyway placed regardless of
> --enable-hardcoded-tables, from which all necessary tables are trivially
> derived at runtime at very low cost:
>
> sample benchmark (x86-64, Haswell, GNU/Linux, single run is really
> what is relevant here since looping drastically changes the bench). 
> Fluctuations
> are on the order of 10% for the single run test:
> 39400 decicycles in aacsbr_tableinit,   1 runs,  0 skips
> 25325 decicycles in aacsbr_tableinit,   2 runs,  0 skips
> 18475 decicycles in aacsbr_tableinit,   4 runs,  0 skips
> 15008 decicycles in aacsbr_tableinit,   8 runs,  0 skips
> 13016 decicycles in aacsbr_tableinit,  16 runs,  0 skips
> 12005 decicycles in aacsbr_tableinit,  32 runs,  0 skips
> 11546 decicycles in aacsbr_tableinit,  64 runs,  0 skips
> 11506 decicycles in aacsbr_tableinit, 128 runs,  0 skips
> 11500 decicycles in aacsbr_tableinit, 256 runs,  0 skips
> 11183 decicycles in aacsbr_tableinit, 509 runs,  3 skips
>
> Tested with FATE with/without --enable-hardcoded-tables.
>
> Signed-off-by: Ganesh Ajjanagadde 
> ---
>  libavcodec/Makefile |  8 ++-
>  libavcodec/aacsbr_fixed_tablegen.c  | 42 
> -
>  libavcodec/aacsbr_fixed_tablegen.h  |  4 
>  libavcodec/aacsbr_tablegen.c| 42 
> -
>  libavcodec/aacsbr_tablegen.h|  4 
>  libavcodec/aacsbr_tablegen_common.h |  4 
>  6 files changed, 2 insertions(+), 102 deletions(-)
>  delete mode 100644 libavcodec/aacsbr_fixed_tablegen.c
>  delete mode 100644 libavcodec/aacsbr_tablegen.c
>
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index d85215d..a4c35b9 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -965,8 +965,6 @@ TOOLS = fourcc2pixfmt
>
>  HOSTPROGS = aacps_tablegen  \
>  aacps_fixed_tablegen\
> -aacsbr_tablegen \
> -aacsbr_fixed_tablegen   \
>  cbrt_tablegen   \
>  cbrt_fixed_tablegen \
>  cos_tablegen\
> @@ -996,8 +994,8 @@ else
>  $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
>  endif
>
> -GEN_HEADERS = cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
> aacps_fixed_tables.h aacsbr_tables.h \
> -  aacsbr_fixed_tables.h dsd_tables.h dv_tables.h \
> +GEN_HEADERS = cbrt_tables.h cbrt_fixed_tables.h aacps_tables.h 
> aacps_fixed_tables.h \
> +  dsd_tables.h dv_tables.h \
>sinewin_tables.h sinewin_fixed_tables.h mpegaudio_tables.h 
> motionpixels_tables.h \
>pcm_tables.h qdm2_tables.h
>  GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS))
> @@ -1010,8 +1008,6 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h
>  $(SUBDIR)aacdec_fixed.o: $(SUBDIR)cbrt_fixed_tables.h
>  $(SUBDIR)aacps_float.o: $(SUBDIR)aacps_tables.h
>  $(SUBDIR)aacps_fixed.o: $(SUBDIR)aacps_fixed_tables.h
> -$(SUBDIR)aacsbr.o: $(SUBDIR)aacsbr_tables.h
> -$(SUBDIR)aacsbr_fixed.o: $(SUBDIR)aacsbr_fixed_tables.h
>  $(SUBDIR)aactab_fixed.o: $(SUBDIR)aac_fixed_tables.h
>  $(SUBDIR)dsddec.o: $(SUBDIR)dsd_tables.h
>  $(SUBDIR)dvenc.o: $(SUBDIR)dv_tables.h
> diff --git a/libavcodec/aacsbr_fixed_tablegen.c 
> b/libavcodec/aacsbr_fixed_tablegen.c
> deleted file mode 100644
> index b896d75..000
> --- a/libavcodec/aacsbr_fixed_tablegen.c
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -/*
> - * Header file for hardcoded AAC SBR windows
> - *
> - * Copyright (c) 2014 Reimar Döffinger 
> - *
> - * 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 
> -#include "libavutil/internal.h"
> -#include "libavutil/common.h"
> -#undef CONFIG_HARDCODED_TABLES
> -#define CONFIG_HARDCODED_TABLES 0
> -#define USE_FIXED 1
> -#

Re: [FFmpeg-devel] [PATCH] mpegtsenc: Fix off-by-one in indexing into Opus channel mapping arrays

2015-12-03 Thread Michael Niedermayer
On Thu, Dec 03, 2015 at 11:04:09PM +0200, Sebastian Dröge wrote:
> From: Sebastian Dröge 
> 
> ---
>  libavformat/mpegtsenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH v3 01/14] mips: rename mipsdspr1 to mipsdsp

2015-12-03 Thread Michael Niedermayer
On Thu, Dec 03, 2015 at 01:22:16PM +, Vicente Olivert Riera wrote:
> Signed-off-by: Vicente Olivert Riera 
> ---
> Changes v2 -> v3:
>  - Document it in the Changelog
> 
> Changes v1 -> v2:
>  - Remove a block of code for mipsdspr2 which wasn't intended to be in
>this patch and it was causing a syntax error in the configure script.
>Highlighted by Michael Niedermayer:
>https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2015-November/183444.html
> 
>  Changelog |  1 +
>  Makefile  |  2 +-
>  arch.mak  |  2 +-
>  configure | 28 ++--
>  libavcodec/aacenc.c   |  2 +-
>  libavcodec/mips/Makefile  |  4 ++--
>  libavcodec/mips/ac3dsp_mips.c |  4 ++--
>  libavcodec/mips/mpegaudiodsp_mips_fixed.c |  2 +-
>  libavcodec/mpegaudiodec_template.c|  4 ++--
>  libavcodec/mpegaudiodsp.c |  2 +-
>  libavcodec/mpegaudiodsp.h |  2 +-
>  11 files changed, 27 insertions(+), 26 deletions(-)

patch applied

thanks

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH] Incorrect FourCC for HE-AAC in ISMV manifest

2015-12-03 Thread Michael Niedermayer
On Wed, Dec 02, 2015 at 06:31:12PM +0100, Yann Coupin wrote:
> Hi,
> 
> According to Microsoft's specs [1] (and after experiencing issues with the
> Unified Streaming Platform [2] server), content encoded with HE-AAC audio
> should use the AACH FourCC, but the value AACL is hardcoded in the manifest
> generation code. So I created the attached patch to fix this. It passes
> "test fate" and its effects can be seen using the commands bellow and
> compatible server.
> 
> Although I tried to follow the patch submission checklist don't hesitate to
> point errors or mistakes.
> 
> Yann
> 
> 
> Sample command lines:
> 
> ffmpeg -i video.mp4 -vn -acodec libfdk_aac -profile:a aac_low -ab 128k -ar
> 44.1k -movflags isml -f ismv http://example.com/
> 
> FourCC of audio track in manifest is AACL as before
> 
> ffmpeg -i video.mp4 -vn -acodec libfdk_aac -profile:a aac_he -ab 64k -ar
> 44.1k -movflags isml -f ismv http://example.com/
> 
> FourCC is AACH
> 
> ffmpeg -i video.mp4 -vn -acodec libfdk_aac -profile:a aac_he_v2 -ab 64k -ar
> 44.1k -movflags isml -f ismv http://example.com/
> 
> FourCC is AACP
> 
> [1] https://msdn.microsoft.com/en-us/library/ff728116%28v=vs.95%29.aspx
> [2] http://www.unified-streaming.com/

>  movenc.c |   12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> f4e405da303c85b76a70d2fb7c0ca163bcc4ffd0  
> 0001-HE-AAC-correct-FourCC-in-ISML.patch
> From 4962e42d1f2310048486a3fea5d338947ee78f9e Mon Sep 17 00:00:00 2001
> From: Yann Coupin 
> Date: Tue, 1 Dec 2015 12:22:38 +0100
> Subject: [PATCH] HE-AAC correct FourCC in ISML
> 
> ---
>  libavformat/movenc.c | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


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


[FFmpeg-devel] Memory leaks in libavformat/segment.c

2015-12-03 Thread Lvqier

Hi,

I am using FFmpeg to generate mpegts segments. FFmpeg has memory leaks, 
see the valgrind output in the attachment.


Command line to reproduce:
> valgrind --tool=memcheck --leak-check=full ./ffmpeg_g -f decklink -i 
'DeckLink Mini Recorder@14' -map 0 -acodec libvo_aacenc -vcodec libx264 
-pix_fmt yuv420p -vprofile baseline -q 2 -r 25 -g 25 -dn -f 
stream_segment -segment_format mpegts -segment_time 10 
/dev/shm/capture/libav-%010d.ts


I have read the source code of libavformat/segment.c and make a patch 
which is attached as well to fix it.


--
/Best Regards,
lvqier - lvq...@gmail.com 
/

**
青春如烟,唱一首笑忘歌

--- ../ffmpeg-2.8.1/libavformat/segment.c   2015-09-09 09:17:47.0 
+0800
+++ libavformat/segment.c   2015-12-03 14:37:45.0 +0800
@@ -388,6 +388,7 @@
 
 end:
 avio_closep(&oc->pb);
+av_freep(&seg->cur_entry.filename);
 
 return ret;
 }
@@ -887,7 +888,7 @@
 av_opt_free(seg);
 av_freep(&seg->times);
 av_freep(&seg->frames);
-av_freep(&seg->cur_entry.filename);
+//av_freep(&seg->cur_entry.filename);
 
 cur = seg->segment_list_entries;
 while (cur) {
==9644== Memcheck, a memory error detector
==9644== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==9644== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==9644== Command: ./ffmpeg_g -f decklink -i DeckLink\ Mini\ Recorder@14 -map 0 
-acodec libvo_aacenc -vcodec libx264 -pix_fmt yuv420p -vprofile baseline -q 2 
-r 25 -g 25 -dn -f stream_segment -segment_format mpegts -segment_time 2 
/dev/shm/capture/libav-%010d.ts
==9644== 
ffmpeg version 2.8.1 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=../build --enable-gpl --enable-version3 
--enable-decklink --disable-filter=showcqt --enable-libx264 
--enable-libvo_aacenc --extra-cflags=-I../../include/ --extra-libs=-ldl
  libavutil  54. 31.100 / 54. 31.100
  libavcodec 56. 60.100 / 56. 60.100
  libavformat56. 40.101 / 56. 40.101
  libavdevice56.  4.100 / 56.  4.100
  libavfilter 5. 40.101 /  5. 40.101
  libswscale  3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc53.  3.100 / 53.  3.100
==9644== Warning: noted but unhandled ioctl 0x90001 with no size/direction 
hints.
==9644==This could cause spurious value errors to appear.
==9644==See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a 
proper wrapper.
==9644== Conditional jump or move depends on uninitialised value(s)
==9644==at 0x6B2FB12: CreateDeckLinkIterator (in /usr/lib/libDeckLinkAPI.so)
==9644==by 0x6A91DF2: CDeckLinkIterator::CDeckLinkIterator() (in 
/usr/lib/libDeckLinkAPI.so)
==9644==by 0x6A91E72: CreateDeckLinkIteratorInstance_Head() (in 
/usr/lib/libDeckLinkAPI.so)
==9644==by 0x4060BD: ff_decklink_read_header (decklink_dec.cpp:386)
==9644==by 0x66C552: avformat_open_input (utils.c:473)
==9644==by 0x47C80C: open_input_file (ffmpeg_opt.c:925)
==9644==by 0x47DD97: open_files (ffmpeg_opt.c:2910)
==9644==by 0x47DD97: ffmpeg_parse_options (ffmpeg_opt.c:2947)
==9644==by 0x46E896: main (ffmpeg.c:4143)
==9644== 
==9644== Conditional jump or move depends on uninitialised value(s)
==9644==at 0x6B2FBED: CreateDeckLinkIterator (in /usr/lib/libDeckLinkAPI.so)
==9644==by 0x6A91DF2: CDeckLinkIterator::CDeckLinkIterator() (in 
/usr/lib/libDeckLinkAPI.so)
==9644==by 0x6A91E72: CreateDeckLinkIteratorInstance_Head() (in 
/usr/lib/libDeckLinkAPI.so)
==9644==by 0x4060BD: ff_decklink_read_header (decklink_dec.cpp:386)
==9644==by 0x66C552: avformat_open_input (utils.c:473)
==9644==by 0x47C80C: open_input_file (ffmpeg_opt.c:925)
==9644==by 0x47DD97: open_files (ffmpeg_opt.c:2910)
==9644==by 0x47DD97: ffmpeg_parse_options (ffmpeg_opt.c:2947)
==9644==by 0x46E896: main (ffmpeg.c:4143)
==9644== 
.
==9644== Use of uninitialised value of size 8
==9644==at 0x54E4A66: ??? (in 
/usr/lib/x86_64-linux-gnu/libvo-aacenc.so.0.0.4)
==9644==by 0x54E56B1: ??? (in 
/usr/lib/x86_64-linux-gnu/libvo-aacenc.so.0.0.4)
==9644==by 0x54E6930: ??? (in 
/usr/lib/x86_64-linux-gnu/libvo-aacenc.so.0.0.4)
==9644==by 0x54E4311: ??? (in 
/usr/lib/x86_64-linux-gnu/libvo-aacenc.so.0.0.4)
==9644==by 0x54D9144: ??? (in 
/usr/lib/x86_64-linux-gnu/libvo-aacenc.so.0.0.4)
==9644==by 0x54D895E: ??? (in 
/usr/lib/x86_64-linux-gnu/libvo-aacenc.so.0.0.4)
==9644==by 0x8B904F: aac_encode_frame (libvo-aacenc.c:165)
==9644==by 0xA38752: avcodec_encode_audio2 (utils.c:1958)
==9644==by 0x48C285: do_audio_out (ffmpeg.c:849)
==9644==by 0x48C285: reap_filters (ffmpeg.c:1398)
==9644==by 0x46EADF: transcode_step (ffmpeg.c:3939)
==9644==by 0x46EADF: transcode (ffmpeg.c:3982)
==9644==by 0x46EADF: main (ffmpeg.c:4165)
==9644== 
==9644== Use of uninitialised v

[FFmpeg-devel] [PATCH] nvenc set slice number to 1 to improve encoding quality

2015-12-03 Thread Agatha Hu
---
 libavcodec/nvenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 43b8e78..b8f7f91 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -762,6 +762,9 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
 }
 }
 
+ctx->encode_config.encodeCodecConfig.h264Config.sliceMode = 3;
+ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData = 1;
+
 /* when there're b frames, set dts offset */
 if (ctx->encode_config.frameIntervalP >= 2)
 ctx->last_dts = -2;
-- 
1.9.5.github.0

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


[FFmpeg-devel] [PATCH] nvenc set slice number to 1 to improve encoding quality

2015-12-03 Thread Agatha Hu

---
 libavcodec/nvenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 43b8e78..b8f7f91 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -762,6 +762,9 @@ static av_cold int nvenc_encode_init(AVCodecContext 
*avctx)

 }
 }

+ctx->encode_config.encodeCodecConfig.h264Config.sliceMode = 3;
+ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData = 1;
+
 /* when there're b frames, set dts offset */
 if (ctx->encode_config.frameIntervalP >= 2)
 ctx->last_dts = -2;
--
1.9.5.github.0



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


[FFmpeg-devel] overlay filter option/alternative

2015-12-03 Thread Ryan Williams
TLDR, Would you consider an 'underlay' filter or perhaps an option on the 
'overlay' filter that reverses the order of the input labels?

Consider the following shorthand syntax "[input][a] overlay [b] overlay [c] 
overlay [output]"
Which expands to "[input][a] overlay [unnamed1]; [b][unnamed1] overlay 
[unnamed2]; [c][unnamed2] overlay [output]"
Giving the final layer composition of "c,b,input,a"

If there was an underlay filter or equivalent the shorthand syntax "[input][a] 
overlay [b] underlay [c] underlay [output]"
Would expand to "[input][a] overlay [unnamed1]; [b][unnamed1] underlay 
[unnamed2]; [c][unnamed2] underlay [output]"
Giving the final layer composition of "input+a+b+c"

I am aware that I can provide longhand syntax to achieve the same result but I 
am programmatically apply a varying number of watermarks and would like to 
avoid a lot of temporary labels.
If you're open to the idea I'm willing to code it.

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


Re: [FFmpeg-devel] overlay filter option/alternative

2015-12-03 Thread Ryan Williams
EDIT: Fixed errors in syntax.

TLDR, Would you consider an 'underlay' filter or perhaps an option on the 
'overlay' filter that reverses the order of the input labels?

Consider the following shorthand syntax "[input][a] overlay, [b] overlay, [c] 
overlay [output]"
Which expands to "[input][a] overlay [unnamed1]; [b][unnamed1] overlay 
[unnamed2]; [c][unnamed2] overlay [output]"
Giving the final layer composition of "c,b,input,a"

If there was an underlay filter or equivalent the shorthand syntax "[input][a] 
overlay, [b] underlay, [c] underlay [output]"
Would expand to "[input][a] overlay [unnamed1]; [b][unnamed1] underlay 
[unnamed2]; [c][unnamed2] underlay [output]"
Giving the final layer composition of "input,a,b,c"

I am aware that I can provide longhand syntax to achieve the same result but I 
am programmatically apply a varying number of watermarks and would like to 
avoid a lot of temporary labels.
If you're open to the idea I'm willing to code it.

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


Re: [FFmpeg-devel] overlay filter option/alternative

2015-12-03 Thread Shyamal Dass
Hi,
I need to remove the green screen gradient. When I am using the colorkey
option blend and similarity. I found there is spills coming in hair. Please
can you suggest me the method to removing that spill from the command line
in FFMPEG.

My command is as follow
:
ffmpeg -i background_video.mp4 -i overlaying_video_with_green_screen.mp4
-filter_complex "[0:v]setpts=PTS-STARTPTS [V1]; [1:v]
 eq=1.0:0:1.3:2.4:0.175686275:0.103529412:0.031372549:0.4,
curves=r='0.2/0.5':g='0.4/0.5':b='0.2/0.5', *colorkey=#0a7c58:0.1:0.2*,
pad=width=1280:height=1020:x=0:y=0:color=#00,
drawtext=fontsize=50:fontcolor=#ff: box=1:
boxcolor=#00:fontfile=/data/arial.ttf:text='Enter your video message
here':x=20:y=820, setpts=PTS-STARTPTS, scale=1280:-1[V2];
[V1][V2]overlay=shortest=1:x=1:y=1" -pix_fmt yuv420p -y final_video.mp4

I will wait for your response. Thanks in advance

Shyamal




Thanks & Regards
Shyamal

On Fri, Dec 4, 2015 at 10:32 AM, Ryan Williams 
wrote:

> TLDR, Would you consider an 'underlay' filter or perhaps an option on the
> 'overlay' filter that reverses the order of the input labels?
>
> Consider the following shorthand syntax "[input][a] overlay [b] overlay
> [c] overlay [output]"
> Which expands to "[input][a] overlay [unnamed1]; [b][unnamed1] overlay
> [unnamed2]; [c][unnamed2] overlay [output]"
> Giving the final layer composition of "c,b,input,a"
>
> If there was an underlay filter or equivalent the shorthand syntax
> "[input][a] overlay [b] underlay [c] underlay [output]"
> Would expand to "[input][a] overlay [unnamed1]; [b][unnamed1] underlay
> [unnamed2]; [c][unnamed2] underlay [output]"
> Giving the final layer composition of "input+a+b+c"
>
> I am aware that I can provide longhand syntax to achieve the same result
> but I am programmatically apply a varying number of watermarks and would
> like to avoid a lot of temporary labels.
> If you're open to the idea I'm willing to code it.
>
> ___
> 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