Re: [FFmpeg-devel] [PATCH] libavfilter/af_hdcd.c: Collect HDCD stats and report

2016-07-03 Thread Carl Eugen Hoyos
Burt P.  gmail.com> writes:

> +/* For user information/stats, pulled up into HDCDContext
> + * by filter_frame() */
> +int _hdcd_detected;

No leading underscores please, same below.

[...]

> +/* update the user info/flags */
> +#define UPDATE_INFO(s,pe,tg,tf)

I believe this should be a function.

> do{if (pe || tg || tf || s->sustain)
> { s->_hdcd_detected = 1; } 

> if (pe) { s->_peak_extend = 1; }

This could be s->peak_extend = !!pe;

[...]

> +int transient_filter = (state->control & 32);

Unneeded parenthesis, feel free to ignore.

[...]

> +s->hdcd_detected = 0;
> +s->peak_extend = 0;
> +s->transient_filter = 0;

These are unneeded, please remove them.

Thank you for the patch, Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] libavfilter/af_hdcd.c: Collect HDCD stats and report

2016-07-03 Thread Moritz Barsnick
On Sat, Jul 02, 2016 at 23:53:20 -0500, Burt P. wrote:

>  static int integrate(hdcd_state_t *state, int *flag, const int32_t
> *samples, int count, int stride)

Your mailer is breaking likes in the patch. You may need to attach it
as a text file, or actually use git send-email.

> +/* update the user info/flags */
> +#define UPDATE_INFO(s,pe,tg,tf) do{if (pe || tg || tf || s->sustain)
> { s->_hdcd_detected = 1; } if (pe) { s->_peak_extend = 1; } if (tf) {
> s->_transient_filter = 1;} if (tg < s->_gain_min) { s->_gain_min=tg; }
>  if (tg > s->_gain_max) { s->_gain_max=tg; } }while(0);

Not more readable, but more compact (and possibly more ffmpeg style):
s->_hdcd_detected = pe || tg || tf || s->sustain;
s->_peak_extend = !!pe;
s->_transient_filter = !!tf;
[...]

> +#define GAINTOFLOAT(g) ((float)(g>>8) + ((float)(g>>7 & 1) * 0.5))

I can think of other ways to do this, but as it's not performace
relevant, it shouldn't matter.

> +if (state->_gain_min < _gain_min) { _gain_min = state->_gain_min; }
> +if (state->_gain_max > _gain_max) { _gain_max = state->_gain_max; }

ffmpeg style would probably be:
if (state->_gain_max > _gain_max)
_gain_max = state->_gain_max;

but for readability, I would have said:
_gain_max = FFMIN(_gain_max, state->_gain_max);
(Or does ffmpeg have an explicit macro for "limit this value"?).

Same above in the UPDATE_INFO macro (-> function).

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


Re: [FFmpeg-devel] [PATCH 1/3] avutil/parseutils: dont assume standard time when parsing a timestamp

2016-07-03 Thread Michael Niedermayer
On Fri, Jul 01, 2016 at 12:58:38AM +0200, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavutil/parseutils.c | 1 +
>  1 file changed, 1 insertion(+)

probably ok

thx

[...]
-- 
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] [PATCH] libavfilter/af_hdcd.c: Collect HDCD stats and report

2016-07-03 Thread Burt P
The new HDCD filter really does nothing to show that it is working or
that HDCD control information was even detected in the stream. This
patch collects information about the decode, like which features were
used, and reports it to the user at the end.

Signed-off-by: Burt P 
---
 libavfilter/af_hdcd.c | 61 +++
 1 file changed, 61 insertions(+)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 16bdcb0..c0233eb 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -823,11 +823,27 @@ typedef struct {
 int code_counterA;
 int code_counterB;
 int code_counterC;
+
+/* For user information/stats, pulled up into HDCDContext
+ * by filter_frame() */
+int hdcd_detected;
+int peak_extend;
+int transient_filter;
+/* 4-bit (3.1) fixed-point, << 7 *
+ * stored positive, but values are negative, so
+ * min and max are swapped when converted to float later */
+int gain_min, gain_max;
 } hdcd_state_t;
 
 typedef struct HDCDContext {
 const AVClass *class;
 hdcd_state_t state[2];
+
+/* User information/stats */
+int hdcd_detected;
+int peak_extend;
+int transient_filter; /* detected, but not implemented */
+float gain_min, gain_max;
 } HDCDContext;
 
 static const AVOption hdcd_options[] = {
@@ -853,6 +869,12 @@ static void hdcd_reset(hdcd_state_t *state, unsigned rate)
 state->code_counterA = 0;
 state->code_counterB = 0;
 state->code_counterC = 0;
+
+state->hdcd_detected = 0;
+state->peak_extend = 0;
+state->gain_min = 0;
+state->gain_max = 0;
+state->transient_filter = 0;
 }
 
 static int integrate(hdcd_state_t *state, int *flag, const int32_t *samples, 
int count, int stride)
@@ -982,14 +1004,25 @@ static int hdcd_envelope(int32_t *samples, int count, 
int stride, int gain, int
 return gain;
 }
 
+/* update the user info/flags */
+#define UPDATE_INFO(s,pe,tg,tf) do{ \
+if (pe || tg || tf || s->sustain) { s->hdcd_detected = 1; } \
+s->peak_extend = !!pe; \
+s->transient_filter = !!tf; \
+s->gain_min = FFMIN(s->gain_min, tg); \
+s->gain_max = FFMAX(s->gain_max, tg); }while(0);
+
 static void hdcd_process(hdcd_state_t *state, int32_t *samples, int count, int 
stride)
 {
 int32_t *samples_end = samples + count * stride;
 int gain = state->running_gain;
 int peak_extend = (state->control & 16);
 int target_gain = (state->control & 15) << 7;
+int transient_filter = state->control & 32;
 int lead = 0;
 
+UPDATE_INFO(state, peak_extend, target_gain, transient_filter);
+
 while (count > lead) {
 int envelope_run;
 int run;
@@ -1006,6 +1039,8 @@ static void hdcd_process(hdcd_state_t *state, int32_t 
*samples, int count, int s
 lead = run - envelope_run;
 peak_extend = (state->control & 16);
 target_gain = (state->control & 15) << 7;
+transient_filter = state->control & 32;
+UPDATE_INFO(state, peak_extend, target_gain, transient_filter);
 }
 if (lead > 0) {
 av_assert0(samples + lead * stride <= samples_end);
@@ -1015,6 +1050,9 @@ static void hdcd_process(hdcd_state_t *state, int32_t 
*samples, int count, int s
 state->running_gain = gain;
 }
 
+/* convert to float from (4-bit (3.1) fixed-point, << 7) */
+#define GAINTOFLOAT(g) ((float)(g>>8) + ((g>>7 & 1) ? 0.5 : 0.0))
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
 AVFilterContext *ctx = inlink->dst;
@@ -1024,6 +1062,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 const int16_t *in_data;
 int32_t *out_data;
 int n, c;
+int gain_min = 0;
+int gain_max = 0;
 
 out = ff_get_audio_buffer(outlink, in->nb_samples);
 if (!out) {
@@ -1042,8 +1082,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*in)
 for (c = 0; c < inlink->channels; c++) {
 hdcd_state_t *state = &s->state[c];
 hdcd_process(state, out_data + c, in->nb_samples, out->channels);
+
+s->hdcd_detected |= state->hdcd_detected;
+s->peak_extend |= state->peak_extend;
+s->transient_filter |= state->transient_filter;
+gain_min = FFMIN(gain_min, state->gain_min);
+gain_max = FFMAX(gain_max, state->gain_max);
 }
 
+/* swapped here because the fixed-point always-negative values
+ *  are stored positive */
+s->gain_max = -(GAINTOFLOAT(gain_min)); /* max = -min */
+s->gain_min = -(GAINTOFLOAT(gain_max)); /* min = -max */
+
 av_frame_free(&in);
 return ff_filter_frame(outlink, out);
 }
@@ -1104,6 +1155,13 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_log(ctx, AV_LOG_VERBOSE, "Channel %d: counter A: %d, B: %d, C: 
%d\n", i, state->code_counterA,
 state->code_counterB, state->code_counterC);
 }
+
+av_log(ctx, AV_LOG_INFO,
+"HDCD detected: %s, peak_extend: %s, transient_filter: %s, min_gain: 
%0.1f dB, max_gain: %0.

Re: [FFmpeg-devel] [PATCH] libavfilter/af_hdcd.c: Collect HDCD stats and report

2016-07-03 Thread Burt P.
Thanks. I've sent a new version of the patch in reply to Carl Eugen
Hoyos, and using git send-email this time, but I saw this message and
included most of the things you mentioned.
I'm still getting used to this.

Anyway, I am curious why both of you think UPDATE_INFO should not
remain a macro? It is only used in that one function, but
unfortunately twice, so I thought a macro would do well there.



On Sun, Jul 3, 2016 at 6:34 AM, Moritz Barsnick  wrote:
> On Sat, Jul 02, 2016 at 23:53:20 -0500, Burt P. wrote:
>
>>  static int integrate(hdcd_state_t *state, int *flag, const int32_t
>> *samples, int count, int stride)
>
> Your mailer is breaking likes in the patch. You may need to attach it
> as a text file, or actually use git send-email.
>
>> +/* update the user info/flags */
>> +#define UPDATE_INFO(s,pe,tg,tf) do{if (pe || tg || tf || s->sustain)
>> { s->_hdcd_detected = 1; } if (pe) { s->_peak_extend = 1; } if (tf) {
>> s->_transient_filter = 1;} if (tg < s->_gain_min) { s->_gain_min=tg; }
>>  if (tg > s->_gain_max) { s->_gain_max=tg; } }while(0);
>
> Not more readable, but more compact (and possibly more ffmpeg style):
> s->_hdcd_detected = pe || tg || tf || s->sustain;
> s->_peak_extend = !!pe;
> s->_transient_filter = !!tf;
> [...]
>
>> +#define GAINTOFLOAT(g) ((float)(g>>8) + ((float)(g>>7 & 1) * 0.5))
>
> I can think of other ways to do this, but as it's not performace
> relevant, it shouldn't matter.
>
>> +if (state->_gain_min < _gain_min) { _gain_min = state->_gain_min; }
>> +if (state->_gain_max > _gain_max) { _gain_max = state->_gain_max; }
>
> ffmpeg style would probably be:
> if (state->_gain_max > _gain_max)
> _gain_max = state->_gain_max;
>
> but for readability, I would have said:
> _gain_max = FFMIN(_gain_max, state->_gain_max);
> (Or does ffmpeg have an explicit macro for "limit this value"?).
>
> Same above in the UPDATE_INFO macro (-> function).
>
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/h264_slice: use sps directly when checking for invalid 8x8 inference

2016-07-03 Thread Clément Bœsch
On Sat, Jul 02, 2016 at 09:07:42PM +0200, Michael Niedermayer wrote:
> On Sat, Jul 02, 2016 at 07:23:35PM +0200, Clément Bœsch wrote:
> > ---
> >  libavcodec/h264_slice.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> LGTM
> 
> thx
> 

applied

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavcodec/mmaldec.c: add interlaced_frame and format struct to AVFrame for deinterlacing

2016-07-03 Thread Jens Ziller
Am Samstag, den 02.07.2016, 17:54 +0200 schrieb Moritz Barsnick:
> On Sun, Jun 26, 2016 at 17:12:14 +0200, Jens Ziller wrote:
> > 
> > +ctx->interlaced_frame = !(interlace_type.eMode ==
> > MMAL_InterlaceProgressive);
> What's wrong with using the "!=" operator instead?

"!=" is a comparing. "= !()" assign with a negate. Here is "= !()"
needed.

> 
> > 
> >  if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
> >  if (!ctx->pool_out)
> > +// in data[2] give the format struct for configure
> > deinterlacer and renderer
> > +frame->data[2] = ctx->decoder->output[0]->format;
> Incorrect indentation.

My fault.

The new patch is attached. Please integrate the patch. That I can
release my App who deal with it.

Regards Jens

> 
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-develFrom 8c8700c6277a73e6c9d0d02d2afbbf8b0e75213e Mon Sep 17 00:00:00 2001
From: Jens Ziller 
Date: Sun, 3 Jul 2016 17:05:35 +0200
Subject: [PATCH] v3 fill AVFrame->interlaced_frame with
 MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T, add a pointer data[2] to
 MMAL_ES_FORMAT_T that user application can invoke MMAL components like
 deinterlacer and renderer with it

---
 libavcodec/mmaldec.c | 17 +
 libavutil/pixfmt.h   |  3 ++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 099a8c5..c4bf414 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -88,6 +88,7 @@ typedef struct MMALDecodeContext {
 int eos_received;
 int eos_sent;
 int extradata_sent;
+int interlaced_frame;
 } MMALDecodeContext;
 
 // Assume decoder is guaranteed to produce output after at least this many
@@ -274,6 +275,7 @@ static int ffmal_update_format(AVCodecContext *avctx)
 int ret = 0;
 MMAL_COMPONENT_T *decoder = ctx->decoder;
 MMAL_ES_FORMAT_T *format_out = decoder->output[0]->format;
+MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T interlace_type;
 
 ffmmal_poolref_unref(ctx->pool_out);
 if (!(ctx->pool_out = av_mallocz(sizeof(*ctx->pool_out {
@@ -300,6 +302,15 @@ static int ffmal_update_format(AVCodecContext *avctx)
 if ((status = mmal_port_format_commit(decoder->output[0])))
 goto fail;
 
+interlace_type.hdr.id = MMAL_PARAMETER_VIDEO_INTERLACE_TYPE;
+interlace_type.hdr.size = sizeof(MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T);
+status = mmal_port_parameter_get(decoder->output[0], &interlace_type.hdr);
+if (status != MMAL_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Cannot read MMAL interlace information!\n");
+} else {
+ctx->interlaced_frame = !(interlace_type.eMode == MMAL_InterlaceProgressive);
+}
+
 if ((ret = ff_set_dimensions(avctx, format_out->es->video.crop.x + format_out->es->video.crop.width,
 format_out->es->video.crop.y + format_out->es->video.crop.height)) < 0)
 goto fail;
@@ -609,7 +620,13 @@ static int ffmal_copy_frame(AVCodecContext *avctx,  AVFrame *frame,
 MMALDecodeContext *ctx = avctx->priv_data;
 int ret = 0;
 
+frame->interlaced_frame = ctx->interlaced_frame;
+
 if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
+
+// in data[2] give the format struct for configure deinterlacer and renderer
+frame->data[2] = ctx->decoder->output[0]->format;
+
 if (!ctx->pool_out)
 return AVERROR_UNKNOWN; // format change code failed with OOM previously
 
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 0ed01c4..98982f8 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -235,7 +235,8 @@ enum AVPixelFormat {
 AV_PIX_FMT_QSV,
 /**
  * HW acceleration though MMAL, data[3] contains a pointer to the
- * MMAL_BUFFER_HEADER_T structure.
+ * MMAL_BUFFER_HEADER_T structure and data[2] contains a pointer to the
+ * MMAL_ES_FORMAT_T structure.
  */
 AV_PIX_FMT_MMAL,
 
-- 
2.7.3

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


Re: [FFmpeg-devel] [PATCH] libavcodec/mmaldec.c: add interlaced_frame and format struct to AVFrame for deinterlacing

2016-07-03 Thread Moritz Barsnick
On Sun, Jul 03, 2016 at 17:20:41 +0200, Jens Ziller wrote:
> Am Samstag, den 02.07.2016, 17:54 +0200 schrieb Moritz Barsnick:
> > On Sun, Jun 26, 2016 at 17:12:14 +0200, Jens Ziller wrote:
> > > 
> > > +ctx->interlaced_frame = !(interlace_type.eMode == 
> > > MMAL_InterlaceProgressive);
> > What's wrong with using the "!=" operator instead?
> 
> "!=" is a comparing. "= !()" assign with a negate. Here is "= !()" needed.

I meant the comparison, not the assignment, so replacing:
  ctx->interlaced_frame = !(interlace_type.eMode == MMAL_InterlaceProgressive)
with
  ctx->interlaced_frame = (interlace_type.eMode != MMAL_InterlaceProgressive)

The former is rather ... convoluted.
(Brackets optional, but probably better for readability.)

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


Re: [FFmpeg-devel] libavdevice/decklink: advanced options for selecting an input connection

2016-07-03 Thread Michael Niedermayer
On Tue, May 10, 2016 at 08:30:11PM +0200, Matthias Hunstock wrote:
> Am 10.05.2016 um 07:54 schrieb Felipe Astroza:
> > This patch add additional input options: video input connection (vinput), 
> > audio input connection (ainput).
> > 
> > Usage:
> > ffmpeg -f decklink -i 'Card name'@fmt :vinput:ainput
> > Where fmt, vinput and ainput are optional
> > 
> > Also it adds list_vinputs and list_ainputs
> 
> Wanted to do the same thing these days...
> 

> There is no attachment?

there seems to be a pull req on github about this
https://github.com/FFmpeg/FFmpeg/pull/212

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] [PATCH] libavcodec/mmaldec.c: add interlaced_frame and format struct to AVFrame for deinterlacing

2016-07-03 Thread Jens Ziller
Am Sonntag, den 03.07.2016, 18:05 +0200 schrieb Moritz Barsnick:
> On Sun, Jul 03, 2016 at 17:20:41 +0200, Jens Ziller wrote:
> > 
> > Am Samstag, den 02.07.2016, 17:54 +0200 schrieb Moritz Barsnick:
> > > 
> > > On Sun, Jun 26, 2016 at 17:12:14 +0200, Jens Ziller wrote:
> > > > 
> > > > 
> > > > +ctx->interlaced_frame = !(interlace_type.eMode ==
> > > > MMAL_InterlaceProgressive);
> > > What's wrong with using the "!=" operator instead?
> > "!=" is a comparing. "= !()" assign with a negate. Here is "= !()"
> > needed.
> I meant the comparison, not the assignment, so replacing:
>   ctx->interlaced_frame = !(interlace_type.eMode ==
> MMAL_InterlaceProgressive)
> with
>   ctx->interlaced_frame = (interlace_type.eMode !=
> MMAL_InterlaceProgressive)
> 
> The former is rather ... convoluted.
> (Brackets optional, but probably better for readability.)
> 
> Moritz

Oh, sorry! I'am so blind. Yes, that's not really smart. I changed that.
The new patch is attached.

Regards Jens

> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-develFrom b724bbe3a13addb055da883cbe802eee74d7c65e Mon Sep 17 00:00:00 2001
From: Jens Ziller 
Date: Sun, 3 Jul 2016 19:25:23 +0200
Subject: [PATCH] v4 fill AVFrame->interlaced_frame with
 MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T, add a pointer data[2] to
 MMAL_ES_FORMAT_T that user application can invoke MMAL components like
 deinterlacer and renderer with it

---
 libavcodec/mmaldec.c | 17 +
 libavutil/pixfmt.h   |  3 ++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 099a8c5..2e7b43c 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -88,6 +88,7 @@ typedef struct MMALDecodeContext {
 int eos_received;
 int eos_sent;
 int extradata_sent;
+int interlaced_frame;
 } MMALDecodeContext;
 
 // Assume decoder is guaranteed to produce output after at least this many
@@ -274,6 +275,7 @@ static int ffmal_update_format(AVCodecContext *avctx)
 int ret = 0;
 MMAL_COMPONENT_T *decoder = ctx->decoder;
 MMAL_ES_FORMAT_T *format_out = decoder->output[0]->format;
+MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T interlace_type;
 
 ffmmal_poolref_unref(ctx->pool_out);
 if (!(ctx->pool_out = av_mallocz(sizeof(*ctx->pool_out {
@@ -300,6 +302,15 @@ static int ffmal_update_format(AVCodecContext *avctx)
 if ((status = mmal_port_format_commit(decoder->output[0])))
 goto fail;
 
+interlace_type.hdr.id = MMAL_PARAMETER_VIDEO_INTERLACE_TYPE;
+interlace_type.hdr.size = sizeof(MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T);
+status = mmal_port_parameter_get(decoder->output[0], &interlace_type.hdr);
+if (status != MMAL_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Cannot read MMAL interlace information!\n");
+} else {
+ctx->interlaced_frame = (interlace_type.eMode != MMAL_InterlaceProgressive);
+}
+
 if ((ret = ff_set_dimensions(avctx, format_out->es->video.crop.x + format_out->es->video.crop.width,
 format_out->es->video.crop.y + format_out->es->video.crop.height)) < 0)
 goto fail;
@@ -609,7 +620,13 @@ static int ffmal_copy_frame(AVCodecContext *avctx,  AVFrame *frame,
 MMALDecodeContext *ctx = avctx->priv_data;
 int ret = 0;
 
+frame->interlaced_frame = ctx->interlaced_frame;
+
 if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
+
+// in data[2] give the format struct for configure deinterlacer and renderer
+frame->data[2] = ctx->decoder->output[0]->format;
+
 if (!ctx->pool_out)
 return AVERROR_UNKNOWN; // format change code failed with OOM previously
 
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 0ed01c4..98982f8 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -235,7 +235,8 @@ enum AVPixelFormat {
 AV_PIX_FMT_QSV,
 /**
  * HW acceleration though MMAL, data[3] contains a pointer to the
- * MMAL_BUFFER_HEADER_T structure.
+ * MMAL_BUFFER_HEADER_T structure and data[2] contains a pointer to the
+ * MMAL_ES_FORMAT_T structure.
  */
 AV_PIX_FMT_MMAL,
 
-- 
2.7.3

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


[FFmpeg-devel] [RFC] beginner difficulty bug trac tag for new open source developers

2016-07-03 Thread compn
hello

about once a month (also, around OPW/GSOC time) we get people in
#ffmpeg-devel or the ml asking about contributing to ffmpeg. i think we
need to try to organize something for new contributors.

usually there is only one or two devs alive (including me) to guide
newbies. most times these want-to-be devs already have knowledge of
git, make, etc and have c or c++ programming skills.

what they ask for is an easy way to start or easy bugs to look at.

so my proposed idea is to make a tag or priority on the bug tracker for
"easy" bugs. that way new contributors can look at a list of bugs that
are easy to fix.

what i need from you, fellow reader:

1. do you think this is a good idea? or do you have other ideas to help?
maybe write a newbie developer guide for developer documentation? is
there any knowledge from the OPW/gsoc mentors that we should put in the
developer docs?

2. what the name of this bug tag should be? "easy bugs" ? "beginner
difficulty" ?

3. are there other oss projects out there that already help new
contributors? can we steal something from them?

i'm not sure what criteria would make for an easy bug vs a hard bug.
but i'd rather leave that open to whoever adds/reviews the bug. i think
we all agree adding a codec tag or documentation is easier than adding
3d mvc h264 support.

i'm also not suggesting tagging every bug with a difficulty rating , as
that would take a while and i'm not sure of the benefit. i just want to
have a solid number (100-300+) of bugs that are somewhat easy to
understand, implement, review and finish.

have a great summer (for those in the northern hemisphere),
-compn
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec: add missing xmm/neon clobber test wrappers for the new decode API

2016-07-03 Thread James Almer
Signed-off-by: James Almer 
---
Tested on Win64 (xmm), but not arm and aarch64 (neon).

 configure |  4 
 libavcodec/aarch64/neontest.c | 10 ++
 libavcodec/arm/neontest.c | 10 ++
 libavcodec/x86/w64xmmtest.c   | 10 ++
 4 files changed, 34 insertions(+)

diff --git a/configure b/configure
index 007c953..22298df 100755
--- a/configure
+++ b/configure
@@ -6027,6 +6027,8 @@ enabled neon_clobber_test &&
   -Wl,--wrap,avcodec_decode_subtitle2   \
   -Wl,--wrap,avcodec_encode_audio2  \
   -Wl,--wrap,avcodec_encode_video2  \
+  -Wl,--wrap,avcodec_send_packet\
+  -Wl,--wrap,avcodec_receive_frame  \
   -Wl,--wrap,avcodec_encode_subtitle\
   -Wl,--wrap,swr_convert\
   -Wl,--wrap,avresample_convert ||
@@ -6040,6 +6042,8 @@ enabled xmm_clobber_test &&
   -Wl,--wrap,avcodec_encode_audio2  \
   -Wl,--wrap,avcodec_encode_video2  \
   -Wl,--wrap,avcodec_encode_subtitle\
+  -Wl,--wrap,avcodec_send_packet\
+  -Wl,--wrap,avcodec_receive_frame  \
   -Wl,--wrap,swr_convert\
   -Wl,--wrap,avresample_convert \
   -Wl,--wrap,sws_scale ||
diff --git a/libavcodec/aarch64/neontest.c b/libavcodec/aarch64/neontest.c
index b1f1a6d..302a322 100644
--- a/libavcodec/aarch64/neontest.c
+++ b/libavcodec/aarch64/neontest.c
@@ -77,3 +77,13 @@ wrap(avcodec_encode_video2(AVCodecContext *avctx, AVPacket 
*avpkt,
 {
 testneonclobbers(avcodec_encode_video2, avctx, avpkt, frame, 
got_packet_ptr);
 }
+
+wrap(avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt))
+{
+testneonclobbers(avcodec_send_packet, avctx, avpkt);
+}
+
+wrap(avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame))
+{
+testneonclobbers(avcodec_receive_frame, avctx, frame);
+}
diff --git a/libavcodec/arm/neontest.c b/libavcodec/arm/neontest.c
index a81d14d..51d158b 100644
--- a/libavcodec/arm/neontest.c
+++ b/libavcodec/arm/neontest.c
@@ -77,3 +77,13 @@ wrap(avcodec_encode_video2(AVCodecContext *avctx, AVPacket 
*avpkt,
 {
 testneonclobbers(avcodec_encode_video2, avctx, avpkt, frame, 
got_packet_ptr);
 }
+
+wrap(avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt))
+{
+testneonclobbers(avcodec_send_packet, avctx, avpkt);
+}
+
+wrap(avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame))
+{
+testneonclobbers(avcodec_receive_frame, avctx, frame);
+}
diff --git a/libavcodec/x86/w64xmmtest.c b/libavcodec/x86/w64xmmtest.c
index 94b3049..3d466d2 100644
--- a/libavcodec/x86/w64xmmtest.c
+++ b/libavcodec/x86/w64xmmtest.c
@@ -77,3 +77,13 @@ wrap(avcodec_encode_video2(AVCodecContext *avctx, AVPacket 
*avpkt,
 {
 testxmmclobbers(avcodec_encode_video2, avctx, avpkt, frame, 
got_packet_ptr);
 }
+
+wrap(avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt))
+{
+testxmmclobbers(avcodec_send_packet, avctx, avpkt);
+}
+
+wrap(avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame))
+{
+testxmmclobbers(avcodec_receive_frame, avctx, frame);
+}
-- 
2.9.0

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


Re: [FFmpeg-devel] [PATCH] avcodec: add missing xmm/neon clobber test wrappers for the new decode API

2016-07-03 Thread Ronald S. Bultje
Hi,

On Sun, Jul 3, 2016 at 3:45 PM, James Almer  wrote:

> Signed-off-by: James Almer 
> ---
> Tested on Win64 (xmm), but not arm and aarch64 (neon).
>
>  configure |  4 
>  libavcodec/aarch64/neontest.c | 10 ++
>  libavcodec/arm/neontest.c | 10 ++
>  libavcodec/x86/w64xmmtest.c   | 10 ++
>  4 files changed, 34 insertions(+)
>

lgtm, thanks.

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


[FFmpeg-devel] [PATCH] avcodec/vaapi_encode_h264: Use av_clip_uintp2()

2016-07-03 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vaapi_encode_h264.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index db9071f..d576ede 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -861,12 +861,12 @@ static int 
vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
 // Try to scale these to a sensible range so that the
 // golomb encode of the value is not overlong.
 mseq->bit_rate_scale =
-av_clip(av_log2(avctx->bit_rate) - 15, 0, 15);
+av_clip_uintp2(av_log2(avctx->bit_rate) - 15, 4);
 mseq->bit_rate_value_minus1[0] =
 (avctx->bit_rate >> mseq->bit_rate_scale) - 1;
 
 mseq->cpb_size_scale =
-av_clip(av_log2(priv->hrd_params.hrd.buffer_size) - 15, 0, 15);
+av_clip_uintp2(av_log2(priv->hrd_params.hrd.buffer_size) - 15, 
4);
 mseq->cpb_size_value_minus1[0] =
 (priv->hrd_params.hrd.buffer_size >> mseq->cpb_size_scale) - 1;
 
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] avcodec: add missing xmm/neon clobber test wrappers for the new decode API

2016-07-03 Thread James Almer
On 7/3/2016 5:24 PM, Ronald S. Bultje wrote:
> Hi,
> 
> On Sun, Jul 3, 2016 at 3:45 PM, James Almer  wrote:
> 
>> Signed-off-by: James Almer 
>> ---
>> Tested on Win64 (xmm), but not arm and aarch64 (neon).
>>
>>  configure |  4 
>>  libavcodec/aarch64/neontest.c | 10 ++
>>  libavcodec/arm/neontest.c | 10 ++
>>  libavcodec/x86/w64xmmtest.c   | 10 ++
>>  4 files changed, 34 insertions(+)
>>
> 
> lgtm, thanks.

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


[FFmpeg-devel] [PATCH]Support QT b64a ARGB64 rawvideo

2016-07-03 Thread Carl Eugen Hoyos
Hi!

Attached patches fix ticket #5657.

Please comment, Carl Eugen
From 1bba7103c093951cab1bb9aa7b5eaf07b44d2781 Mon Sep 17 00:00:00 2001
From: v0lt 
Date: Sun, 3 Jul 2016 23:04:08 +0200
Subject: [PATCH 1/2] lavc/rawdec: Support QuickTime b64a ARGB64 rawvideo.

Fixes ticket #5657.
---
 libavcodec/raw.c |1 +
 libavcodec/rawdec.c  |9 +
 libavcodec/version.h |2 +-
 libavformat/isom.c   |1 +
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index bfa2537..35dfbab 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -224,6 +224,7 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_ABGR,MKTAG('A', 'B', 'G', 'R') },
 { AV_PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') },
 { AV_PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') },
+{ AV_PIX_FMT_RGBA64BE,MKTAG('b', '6', '4', 'a') },
 
 /* vlc */
 { AV_PIX_FMT_YUV410P, MKTAG('I', '4', '1', '0') },
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 765e567..8085ffa 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -444,6 +444,15 @@ static int raw_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 }
 }
 
+if (avctx->codec_tag == MKTAG('b', '6', '4', 'a') &&
+avctx->pix_fmt   == AV_PIX_FMT_RGBA64BE) {
+uint64_t *pixel = frame->data[0];
+int i, n = avctx->width * avctx->height;
+for (i = 0; i < n; i++) {
+*pixel++ = *pixel << 48 | *pixel >> 16;
+}
+}
+
 if (avctx->field_order > AV_FIELD_PROGRESSIVE) { /* we have interlaced 
material flagged in container */
 frame->interlaced_frame = 1;
 if (avctx->field_order == AV_FIELD_TT || avctx->field_order == 
AV_FIELD_TB)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 4f6423b..5e04754 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  48
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/isom.c b/libavformat/isom.c
index d412f06..cb457dd 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -86,6 +86,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('A', 'B', 'G', 'R') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('b', '1', '6', 'g') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('b', '4', '8', 'r') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('b', '6', '4', 'a') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('b', 'x', 'b', 'g') }, /* BOXX */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('b', 'x', 'r', 'g') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('b', 'x', 'y', 'v') },
-- 
1.7.10.4

From a39dab26a0ea6d89eef761492ea09b45346fd413 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sun, 3 Jul 2016 23:05:44 +0200
Subject: [PATCH 2/2] lavc/rawenc: Support QuickTime b64a ARGB64 rawvideo.

---
 libavcodec/rawenc.c  |8 
 libavcodec/version.h |2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
index d837056..f1c0c5a 100644
--- a/libavcodec/rawenc.c
+++ b/libavcodec/rawenc.c
@@ -69,6 +69,14 @@ static int raw_encode(AVCodecContext *avctx, AVPacket *pkt,
 int x;
 for(x = 1; x < frame->height*frame->width*2; x += 2)
 pkt->data[x] ^= 0x80;
+} else if (avctx->codec_tag == AV_RL32("b64a") && ret > 0 &&
+frame->format == AV_PIX_FMT_RGBA64BE) {
+uint64_t pixel;
+int x;
+for (x = 0; x < frame->height * frame->width; x++) {
+pixel = AV_RN64(&pkt->data[8 * x]);
+AV_WN64(&pkt->data[8 * x], pixel << 16 | pixel >> 48);
+}
 }
 pkt->flags |= AV_PKT_FLAG_KEY;
 *got_packet = 1;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5e04754..310aa95 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  48
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MICRO 103
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH] configure: disable the new optimizer in Visual Studio 2015 Update 3

2016-07-03 Thread Hendrik Leppkes
On Tue, Jun 28, 2016 at 12:01 PM, Hendrik Leppkes  wrote:
> On Tue, Jun 28, 2016 at 11:48 AM, Hendrik Leppkes  wrote:
>> Visual Studio 2015 Update 3 introduced a new SSA optimizer, however
>> it unfortunately causes miscompilations. Until it is fixed, the new
>> optimizations are disabled and should be re-checked on subsequent
>> compiler releases.
>>
>> Fixes recent FATE failure of fate-lavf-pam on VS2015.
>
> On that note, i'm not exactly sure which code actually miscompiles.
> I though its pamenc, but the generated files are identical, then I
> though its the crc computing code (crcenc/adler32), but those seem
> fine as well and would likely screw up in more then one case if they
> would miscompile.
>
> So that leaves pnmdec, I suppose, but I didn't make much headway to
> poke around in that. If anyone has any handy hints how to find the
> code in question that might be helpful.
> Maybe the code is actually not-quite-right and might enjoy some straigtening.
>

Applied the patch to disable the new optimizations in MSVC as I did
not spot anything obviously "bad" in pamdec - which does not mean
there isn't anything there, of course.

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


[FFmpeg-devel] [PATCH] x86/dcadsp: optimize lfe_fir0_float_fma3 on x86_32

2016-07-03 Thread James Almer
About 10% faster.

Signed-off-by: James Almer 
---
 libavcodec/x86/dcadsp.asm | 43 +++
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/libavcodec/x86/dcadsp.asm b/libavcodec/x86/dcadsp.asm
index c5bf21a..055361a 100644
--- a/libavcodec/x86/dcadsp.asm
+++ b/libavcodec/x86/dcadsp.asm
@@ -24,7 +24,7 @@
 SECTION .text
 
 %define sizeof_float 4
-%define FMA3_OFFSET (8 * cpuflag(fma3) * ARCH_X86_64)
+%define FMA3_OFFSET (8 * cpuflag(fma3))
 
 %macro LFE_FIR0_FLOAT 0
 cglobal lfe_fir0_float, 4, 6, 12 + cpuflag(fma3)*4, samples, lfe, coeff, 
nblocks, cnt1, cnt2
@@ -101,11 +101,19 @@ cglobal lfe_fir0_float, 4, 6, 12 + cpuflag(fma3)*4, 
samples, lfe, coeff, nblocks
 %endif
 %else ; ARCH_X86_32
 %if cpuflag(fma3)
-mulps m0, m7, [coeffq+cnt1q*8   ]
-movapsm1, [coeffq+cnt1q*8+16]
-mulps m2, m7, [coeffq+cnt1q*8+32]
-fmaddps   m0, m6, m1, m0
-fmaddps   m2, m6, [coeffq+cnt1q*8+48], m2
+mulps m0, m7, [coeffq+cnt1q*8]
+mulps m1, m7, [coeffq+cnt1q*8+32 ]
+mulps m2, m7, [coeffq+cnt1q*8+64 ]
+mulps m3, m7, [coeffq+cnt1q*8+96 ]
+fmaddps   m0, m6, [coeffq+cnt1q*8+16 ], m0
+fmaddps   m1, m6, [coeffq+cnt1q*8+48 ], m1
+fmaddps   m2, m6, [coeffq+cnt1q*8+80 ], m2
+fmaddps   m3, m6, [coeffq+cnt1q*8+112], m3
+
+haddpsm0, m1
+haddpsm2, m3
+haddpsm0, m2
+movaps [samplesq+cnt1q], m0
 %else
 mulps m0, m7, [coeffq+cnt1q*8   ]
 mulps m1, m6, [coeffq+cnt1q*8+16]
@@ -113,13 +121,14 @@ cglobal lfe_fir0_float, 4, 6, 12 + cpuflag(fma3)*4, 
samples, lfe, coeff, nblocks
 mulps m3, m6, [coeffq+cnt1q*8+48]
 addps m0, m1
 addps m2, m3
-%endif
+
 unpckhps  m3, m0, m2
 unpcklps  m0, m2
 addps m3, m0
 movhlps   m2, m3
 addps m2, m3
 movlps [samplesq+cnt1q], m2
+%endif
 %endif; ARCH
 
 %if ARCH_X86_64
@@ -154,10 +163,19 @@ cglobal lfe_fir0_float, 4, 6, 12 + cpuflag(fma3)*4, 
samples, lfe, coeff, nblocks
 %endif
 %else ; ARCH_X86_32
 %if cpuflag(fma3)
-mulps m0, m5, [coeffq+cnt1q*8   ]
-mulps m2, m5, [coeffq+cnt1q*8+32]
-fmaddps   m0, m4, m1, m0
-fmaddps   m2, m4, [coeffq+cnt1q*8+48], m2
+mulps m0, m5, [coeffq+cnt1q*8]
+mulps m1, m5, [coeffq+cnt1q*8+32 ]
+mulps m2, m5, [coeffq+cnt1q*8+64 ]
+mulps m3, m5, [coeffq+cnt1q*8+96 ]
+fmaddps   m0, m4, [coeffq+cnt1q*8+16 ], m0
+fmaddps   m1, m4, [coeffq+cnt1q*8+48 ], m1
+fmaddps   m2, m4, [coeffq+cnt1q*8+80 ], m2
+fmaddps   m3, m4, [coeffq+cnt1q*8+112], m3
+
+haddpsm1, m0
+haddpsm3, m2
+haddpsm3, m1
+movaps [samplesq+cnt2q], m3
 %else
 mulps m0, m5, [coeffq+cnt1q*8   ]
 mulps m1, m4, [coeffq+cnt1q*8+16]
@@ -165,13 +183,14 @@ cglobal lfe_fir0_float, 4, 6, 12 + cpuflag(fma3)*4, 
samples, lfe, coeff, nblocks
 mulps m3, m4, [coeffq+cnt1q*8+48]
 addps m0, m1
 addps m2, m3
-%endif
+
 unpckhps  m3, m2, m0
 unpcklps  m2, m0
 addps m3, m2
 movhlps   m0, m3
 addps m0, m3
 movlps [samplesq+cnt2q], m0
+%endif
 %endif; ARCH
 
 subcnt2d, 8 + FMA3_OFFSET
-- 
2.9.0

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


[FFmpeg-devel] [PATCH] PPC64: Add versions of functions in libswscale/input.c optimized for POWER8 VSX SIMD.

2016-07-03 Thread Dan Parrot
Finish providing SIMD versions for POWER8 VSX of functions in libswscale/input.c
That should allow trac ticket #5570 to be closed.
---
 libswscale/ppc/input_vsx.c | 1018 +++-
 1 file changed, 1014 insertions(+), 4 deletions(-)

diff --git a/libswscale/ppc/input_vsx.c b/libswscale/ppc/input_vsx.c
index d977a32..2c6f0ce 100644
--- a/libswscale/ppc/input_vsx.c
+++ b/libswscale/ppc/input_vsx.c
@@ -54,6 +54,7 @@ static void abgrToA_c_vsx(uint8_t *_dst, const uint8_t *src, 
const uint8_t *unus
 for ( i = 0; i < width_adj; i += 8) {
 vector int v_rd0 = vec_vsx_ld(0, (int *)src_addr);
 vector int v_rd1 = vec_vsx_ld(0, (int *)(src_addr + 16));
+vector int v_dst;
 
 v_rd0 = vec_and(v_rd0, vec_splats(0x0ff));
 v_rd1 = vec_and(v_rd1, vec_splats(0x0ff));
@@ -61,8 +62,8 @@ static void abgrToA_c_vsx(uint8_t *_dst, const uint8_t *src, 
const uint8_t *unus
 v_rd0 = vec_sl(v_rd0, vec_splats((unsigned)6));
 v_rd1 = vec_sl(v_rd1, vec_splats((unsigned)6));
 
-vector int v_dst = vec_perm(v_rd0, v_rd1, ((vector unsigned char)
-   {0, 1, 4, 5, 8, 9, 12, 13, 
16, 17, 20, 21, 24, 25, 28, 29}));
+v_dst = vec_perm(v_rd0, v_rd1, ((vector unsigned char)
+{0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 
21, 24, 25, 28, 29}));
 vec_vsx_st((vector unsigned char)v_dst, 0, (unsigned char *)dst_addr);
 
 src_addr += 32;
@@ -91,6 +92,7 @@ static void rgbaToA_c_vsx(uint8_t *_dst, const uint8_t *src, 
const uint8_t *unus
 for ( i = 0; i < width_adj; i += 8) {
 vector int v_rd0 = vec_vsx_ld(0, (int *)src_addr);
 vector int v_rd1 = vec_vsx_ld(0, (int *)(src_addr + 16));
+vector int v_dst;
 
 v_rd0 = vec_sld(v_rd0, v_rd0, 13);
 v_rd1 = vec_sld(v_rd1, v_rd1, 13);
@@ -101,8 +103,8 @@ static void rgbaToA_c_vsx(uint8_t *_dst, const uint8_t 
*src, const uint8_t *unus
 v_rd0 = vec_sl(v_rd0, vec_splats((unsigned)6));
 v_rd1 = vec_sl(v_rd1, vec_splats((unsigned)6));
 
-vector int v_dst = vec_perm(v_rd0, v_rd1, ((vector unsigned char)
-   {0, 1, 4, 5, 8, 9, 12, 13, 
16, 17, 20, 21, 24, 25, 28, 29}));
+v_dst = vec_perm(v_rd0, v_rd1, ((vector unsigned char)
+{0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 
21, 24, 25, 28, 29}));
 vec_vsx_st((vector unsigned char)v_dst, 0, (unsigned char *)dst_addr);
 
 src_addr += 32;
@@ -114,6 +116,175 @@ static void rgbaToA_c_vsx(uint8_t *_dst, const uint8_t 
*src, const uint8_t *unus
 }
 }
 
+static void monoblack2Y_c_vsx(uint8_t *_dst, const uint8_t *src, const uint8_t 
*unused1, const uint8_t *unused2,
+  int width, uint32_t *unused)
+{
+int16_t *dst = (int16_t *)_dst;
+int i, j, width_adj, frag_len;
+
+vector unsigned charv_rd;
+vector signed short v_din, v_d, v_dst;
+vector unsigned short   v_opr;
+
+uintptr_t src_addr = (uintptr_t)src;
+uintptr_t dst_addr = (uintptr_t)dst;
+
+width = (width + 7) >> 3;
+
+// compute integral number of vector-length items and length of final 
fragment
+width_adj = width >> 3;
+width_adj = width_adj << 3;
+frag_len = width - width_adj;
+
+v_opr = (vector unsigned short) {7, 6, 5, 4, 3, 2, 1, 0};
+
+for (i = 0; i < width_adj; i += 8) {
+if (i & 0x0f) {
+v_rd = vec_sld(v_rd, v_rd, 8);
+} else {
+v_rd = vec_vsx_ld(0, (unsigned char *)src_addr);
+src_addr += 16;
+}
+
+v_din = vec_unpackh((vector signed char)v_rd);
+v_din = vec_and(v_din, vec_splats((short)0x00ff));
+
+for (j = 0; j < 8; j++) {
+switch(j) {
+case 0:
+v_d = vec_splat(v_din, 0);
+break;
+case 1:
+v_d = vec_splat(v_din, 1);
+break;
+case 2:
+v_d = vec_splat(v_din, 2);
+break;
+case 3:
+v_d = vec_splat(v_din, 3);
+break;
+case 4:
+v_d = vec_splat(v_din, 4);
+break;
+case 5:
+v_d = vec_splat(v_din, 5);
+break;
+case 6:
+v_d = vec_splat(v_din, 6);
+break;
+case 7:
+v_d = vec_splat(v_din, 7);
+break;
+}
+
+v_dst = vec_sr(v_d, v_opr);
+v_dst = vec_and(v_dst, vec_splats((short)1));
+v_dst = v_dst * vec_splats((short)16383);
+
+vec_vsx_st(v_dst, 0, (short *)dst_addr);
+dst_addr += 16;
+}
+}
+
+for (i = width_adj; i < width_adj + frag_len; i++) {
+int d = src[i];
+for (j = 0; j < 8; j++)
+dst[8*i+j]= ((d>>(7-j))&1

Re: [FFmpeg-devel] [PATCH] configure: disable the new optimizer in Visual Studio 2015 Update 3

2016-07-03 Thread Kacper Michajlow
2016-07-03 23:39 GMT+02:00 Hendrik Leppkes :
> On Tue, Jun 28, 2016 at 12:01 PM, Hendrik Leppkes  wrote:
>> On Tue, Jun 28, 2016 at 11:48 AM, Hendrik Leppkes  
>> wrote:
>>> Visual Studio 2015 Update 3 introduced a new SSA optimizer, however
>>> it unfortunately causes miscompilations. Until it is fixed, the new
>>> optimizations are disabled and should be re-checked on subsequent
>>> compiler releases.
>>>
>>> Fixes recent FATE failure of fate-lavf-pam on VS2015.
>>
>> On that note, i'm not exactly sure which code actually miscompiles.
>> I though its pamenc, but the generated files are identical, then I
>> though its the crc computing code (crcenc/adler32), but those seem
>> fine as well and would likely screw up in more then one case if they
>> would miscompile.
>>
>> So that leaves pnmdec, I suppose, but I didn't make much headway to
>> poke around in that. If anyone has any handy hints how to find the
>> code in question that might be helpful.
>> Maybe the code is actually not-quite-right and might enjoy some straigtening.
>>
>
> Applied the patch to disable the new optimizations in MSVC as I did
> not spot anything obviously "bad" in pamdec - which does not mean
> there isn't anything there, of course.
>

This is pretty bad miscompilation in new SSA optimizer. It assumes
that variable declared in loop doesn't change the value even if there
is assignment. I minimized testcese and reported the bug
https://connect.microsoft.com/VisualStudio/feedback/details/2890170

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


Re: [FFmpeg-devel] [PATCH] libavfilter/af_hdcd.c: Collect HDCD stats and report

2016-07-03 Thread Burt P.
I've attached a third attempt at this patch with all the
suggestions by Carl Eugen Hoyos and Moritz Barsnick,
including converting the UPDATE_INFO macro into a
function, and some more comments and little fixes.

Thanks.
From 2dbbfc0cea83b769b5b02eecc5ec3dabc477457b Mon Sep 17 00:00:00 2001
From: Burt P 
Date: Sun, 3 Jul 2016 21:46:10 -0500
Subject: [PATCH] libavfilter/af_hdcd.c: Collect HDCD stats and report

The new HDCD filter really does nothing to show that it is working or
that HDCD control information was even detected in the stream. This
patch collects information about the decode, like which features were
used, and reports it to the user at the end.

Signed-off-by: Burt P 
---
 libavfilter/af_hdcd.c | 65 +++
 1 file changed, 65 insertions(+)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 16bdcb0..d00d846 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -823,11 +823,27 @@ typedef struct {
 int code_counterA;
 int code_counterB;
 int code_counterC;
+
+/* For user information/stats, pulled up into HDCDContext
+ * by filter_frame() */
+int hdcd_detected; /* if ever detected */
+int peak_extend;   /* if ever enabled */
+int transient_filter;  /* if ever enabled */
+/* 4-bit (3.1) fixed-point, << 7 *
+ * stored positive, but values are negative, so
+ * min and max are swapped when converted to float later */
+int gain_min, gain_max;
 } hdcd_state_t;
 
 typedef struct HDCDContext {
 const AVClass *class;
 hdcd_state_t state[2];
+
+/* User information/stats */
+int hdcd_detected;
+int uses_peak_extend;
+int uses_transient_filter; /* detected, but not implemented */
+float gain_min, gain_max;
 } HDCDContext;
 
 static const AVOption hdcd_options[] = {
@@ -853,6 +869,12 @@ static void hdcd_reset(hdcd_state_t *state, unsigned rate)
 state->code_counterA = 0;
 state->code_counterB = 0;
 state->code_counterC = 0;
+
+state->hdcd_detected = 0;
+state->peak_extend = 0;
+state->gain_min = 0;
+state->gain_max = 0;
+state->transient_filter = 0;
 }
 
 static int integrate(hdcd_state_t *state, int *flag, const int32_t *samples, int count, int stride)
@@ -982,6 +1004,20 @@ static int hdcd_envelope(int32_t *samples, int count, int stride, int gain, int
 return gain;
 }
 
+/* update the user info/flags */
+static void hdcd_update_info(hdcd_state_t *state)
+{
+int target_gain = (state->control & 15) << 7;
+state->gain_min = FFMIN(state->gain_min, target_gain);
+state->gain_max = FFMAX(state->gain_max, target_gain);
+state->peak_extend |= !!(state->control & 16);
+state->transient_filter |= !!(state->control & 32);
+state->hdcd_detected |= target_gain
+|| state->peak_extend
+|| state->transient_filter
+|| state->sustain;
+}
+
 static void hdcd_process(hdcd_state_t *state, int32_t *samples, int count, int stride)
 {
 int32_t *samples_end = samples + count * stride;
@@ -990,6 +1026,8 @@ static void hdcd_process(hdcd_state_t *state, int32_t *samples, int count, int s
 int target_gain = (state->control & 15) << 7;
 int lead = 0;
 
+hdcd_update_info(state);
+
 while (count > lead) {
 int envelope_run;
 int run;
@@ -1006,6 +1044,7 @@ static void hdcd_process(hdcd_state_t *state, int32_t *samples, int count, int s
 lead = run - envelope_run;
 peak_extend = (state->control & 16);
 target_gain = (state->control & 15) << 7;
+hdcd_update_info(state);
 }
 if (lead > 0) {
 av_assert0(samples + lead * stride <= samples_end);
@@ -1015,6 +1054,9 @@ static void hdcd_process(hdcd_state_t *state, int32_t *samples, int count, int s
 state->running_gain = gain;
 }
 
+/* convert to float from (4-bit (3.1) fixed-point, << 7) */
+#define GAINTOFLOAT(g) ((float)(g>>8) + ((g>>7 & 1) ? 0.5 : 0.0))
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
 AVFilterContext *ctx = inlink->dst;
@@ -1024,6 +1066,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 const int16_t *in_data;
 int32_t *out_data;
 int n, c;
+int gain_min = 0;
+int gain_max = 0;
 
 out = ff_get_audio_buffer(outlink, in->nb_samples);
 if (!out) {
@@ -1042,8 +1086,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 for (c = 0; c < inlink->channels; c++) {
 hdcd_state_t *state = &s->state[c];
 hdcd_process(state, out_data + c, in->nb_samples, out->channels);
+
+s->hdcd_detected |= state->hdcd_detected;
+s->uses_peak_extend |= state->peak_extend;
+s->uses_transient_filter |= state->transient_filter;
+gain_min = FFMIN(gain_min, state->gain_min);
+gain_max = FFMAX(gain_max, state->gain_max);
 }
 
+/* swapped here because the fixed-point always-negative values
+ *  are stored positive */
+s->gain_max = FFMAX(s->ga

Re: [FFmpeg-devel] [PATCH] PPC64: Add versions of functions in libswscale/input.c optimized for POWER8 VSX SIMD.

2016-07-03 Thread Carl Eugen Hoyos
Dan Parrot  mail.com> writes:

> Finish providing SIMD versions for POWER8 VSX of functions 
> in libswscale/input.c
> That should allow trac ticket #5570 to be closed.

Please add some numbers:
Either for single functions or for a single ffmpeg command.
(for rgb/bgr, mono is irrelevant)

Carl Eugen

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