[FFmpeg-devel] [PATCH] hwcontext_vdpau: implement av_hwdevice_get_hwframe_constraints()

2018-01-12 Thread wm4
In addition, this does not allow creating frames contexts with sw_format
for which no known transfer formats exist. In theory, we should check
whether the chroma format (i.e. the sw_format) is supported at all by
the vdpau driver, but checking for transfer formats has the same effect.

Note that the pre-existing code adds 1 to priv->nb_pix_fmts[i] for
unknown reason, and some checks need to account for that to check for
empty lists. They are not off-by-one errors.
---
 libavutil/hwcontext_vdpau.c | 55 -
 1 file changed, 39 insertions(+), 16 deletions(-)

diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
index 9b8f839647..c11c3cfdab 100644
--- a/libavutil/hwcontext_vdpau.c
+++ b/libavutil/hwcontext_vdpau.c
@@ -79,11 +79,12 @@ static const VDPAUPixFmtMap pix_fmts_444[] = {
 
 static const struct {
 VdpChromaType chroma_type;
+enum AVPixelFormat frames_sw_format;
 const VDPAUPixFmtMap *map;
 } vdpau_pix_fmts[] = {
-{ VDP_CHROMA_TYPE_420, pix_fmts_420 },
-{ VDP_CHROMA_TYPE_422, pix_fmts_422 },
-{ VDP_CHROMA_TYPE_444, pix_fmts_444 },
+{ VDP_CHROMA_TYPE_420, AV_PIX_FMT_YUV420P, pix_fmts_420 },
+{ VDP_CHROMA_TYPE_422, AV_PIX_FMT_YUV422P, pix_fmts_422 },
+{ VDP_CHROMA_TYPE_444, AV_PIX_FMT_YUV444P, pix_fmts_444 },
 };
 
 static int count_pixfmts(const VDPAUPixFmtMap *map)
@@ -170,6 +171,35 @@ static void vdpau_device_uninit(AVHWDeviceContext *ctx)
 av_freep(&priv->pix_fmts[i]);
 }
 
+static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx,
+const void *hwconfig,
+AVHWFramesConstraints *constraints)
+{
+VDPAUDeviceContext   *priv  = ctx->internal->priv;
+int nb_sw_formats = 0;
+int i;
+
+constraints->valid_sw_formats = 
av_malloc_array(FF_ARRAY_ELEMS(vdpau_pix_fmts) + 1,
+
sizeof(*constraints->valid_sw_formats));
+if (!constraints->valid_sw_formats)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < FF_ARRAY_ELEMS(vdpau_pix_fmts); i++) {
+if (priv->nb_pix_fmts[i] > 1)
+constraints->valid_sw_formats[nb_sw_formats++] = 
vdpau_pix_fmts[i].frames_sw_format;
+}
+constraints->valid_sw_formats[nb_sw_formats] = AV_PIX_FMT_NONE;
+
+constraints->valid_hw_formats = av_malloc_array(2, 
sizeof(*constraints->valid_hw_formats));
+if (!constraints->valid_hw_formats)
+return AVERROR(ENOMEM);
+
+constraints->valid_hw_formats[0] = AV_PIX_FMT_VDPAU;
+constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
+
+return 0;
+}
+
 static void vdpau_buffer_free(void *opaque, uint8_t *data)
 {
 AVHWFramesContext  *ctx = opaque;
@@ -214,26 +244,18 @@ static int vdpau_frames_init(AVHWFramesContext *ctx)
 
 int i;
 
-switch (ctx->sw_format) {
-case AV_PIX_FMT_YUV420P: priv->chroma_type = VDP_CHROMA_TYPE_420; break;
-case AV_PIX_FMT_YUV422P: priv->chroma_type = VDP_CHROMA_TYPE_422; break;
-case AV_PIX_FMT_YUV444P: priv->chroma_type = VDP_CHROMA_TYPE_444; break;
-default:
-av_log(ctx, AV_LOG_ERROR, "Unsupported data layout: %s\n",
-   av_get_pix_fmt_name(ctx->sw_format));
-return AVERROR(ENOSYS);
-}
-
 for (i = 0; i < FF_ARRAY_ELEMS(vdpau_pix_fmts); i++) {
-if (vdpau_pix_fmts[i].chroma_type == priv->chroma_type) {
+if (vdpau_pix_fmts[i].frames_sw_format == ctx->sw_format) {
+priv->chroma_type = vdpau_pix_fmts[i].chroma_type;
 priv->chroma_idx  = i;
 priv->pix_fmts= device_priv->pix_fmts[i];
 priv->nb_pix_fmts = device_priv->nb_pix_fmts[i];
 break;
 }
 }
-if (!priv->pix_fmts) {
-av_log(ctx, AV_LOG_ERROR, "Unsupported chroma type: %d\n", 
priv->chroma_type);
+if (priv->nb_pix_fmts < 2) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported sw format: %s\n",
+   av_get_pix_fmt_name(ctx->sw_format));
 return AVERROR(ENOSYS);
 }
 
@@ -468,6 +490,7 @@ const HWContextType ff_hwcontext_type_vdpau = {
 #endif
 .device_init  = vdpau_device_init,
 .device_uninit= vdpau_device_uninit,
+.frames_get_constraints = vdpau_frames_get_constraints,
 .frames_init  = vdpau_frames_init,
 .frames_get_buffer= vdpau_get_buffer,
 .transfer_get_formats = vdpau_transfer_get_formats,
-- 
2.15.1

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


Re: [FFmpeg-devel] [RFC]Use ptrdiff_t for linesize and stride

2018-01-12 Thread James Almer
On 1/12/2018 10:46 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Seeing 6e80079a it appears that the unstable period is not over yet.
> Vittorio posted a patch that introduces a temporary type to avoid
> breaking API, but that may not be relevant if the api currently
> unstable.

The ABI is what is in the unstable post bump period (Although that
should end soon), but the API never goes through such thing.
It's why the two years deprecation periods exist every time a public
symbol needs to be removed or some behavior changed, and why Vittorio's
patch implemented this by starting one.

> 
> Attached patch (inspired by Vittorio's RFC) passes fate with
> --disable-asm and does not introduce new warnings with gcc 6.3.
> Do we generally need this change?
> Do we generally want it?
> 
> If yes, I will likely need help for the asm changes.
> 
> I would like to avoid a temporary type and I would like to avoid a
> future version bump only because this change suddenly becomes
> necessary.
> 
> Please comment, Carl Eugen
> 
> 
> 
> ___
> 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] [RFC]Use ptrdiff_t for linesize and stride

2018-01-12 Thread wm4
On Sat, 13 Jan 2018 03:47:31 +0100
Carl Eugen Hoyos  wrote:

> 2018-01-13 3:19 GMT+01:00 wm4 :
> > On Sat, 13 Jan 2018 02:46:51 +0100
> > Carl Eugen Hoyos  wrote:
> >  
> >> Hi!
> >>
> >> Seeing 6e80079a it appears that the unstable period is not over yet.
> >> Vittorio posted a patch that introduces a temporary type to avoid
> >> breaking API, but that may not be relevant if the api currently
> >> unstable.
> >>
> >> Attached patch (inspired by Vittorio's RFC) passes fate with
> >> --disable-asm and does not introduce new warnings with gcc 6.3.
> >> Do we generally need this change?
> >> Do we generally want it?
> >>
> >> If yes, I will likely need help for the asm changes.
> >>
> >> I would like to avoid a temporary type and I would like to avoid a
> >> future version bump only because this change suddenly becomes
> >> necessary.
> >>
> >> Please comment, Carl Eugen  
> >
> > Doing that now would break EVERY API user.  
> 
> As opposed to causing trouble only to those users who happen
> to run libavcodec on a new Intel cpu? We seem to disagree
> which is worse...
> Anyway, since we had no release since the last bump, we
> could simply bump again if this change has any advantage.

What does this have to do with new Intel CPUs?

Also you can't be serious about breaking the API this badly. Also,
we're in an ABI unstable period - we never have API unstable periods.
The suggested change does not only change the ABI, but it breaks the
API as well, because the change is not source compatible.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [RFC]Use ptrdiff_t for linesize and stride

2018-01-12 Thread Carl Eugen Hoyos
2018-01-13 3:19 GMT+01:00 wm4 :
> On Sat, 13 Jan 2018 02:46:51 +0100
> Carl Eugen Hoyos  wrote:
>
>> Hi!
>>
>> Seeing 6e80079a it appears that the unstable period is not over yet.
>> Vittorio posted a patch that introduces a temporary type to avoid
>> breaking API, but that may not be relevant if the api currently
>> unstable.
>>
>> Attached patch (inspired by Vittorio's RFC) passes fate with
>> --disable-asm and does not introduce new warnings with gcc 6.3.
>> Do we generally need this change?
>> Do we generally want it?
>>
>> If yes, I will likely need help for the asm changes.
>>
>> I would like to avoid a temporary type and I would like to avoid a
>> future version bump only because this change suddenly becomes
>> necessary.
>>
>> Please comment, Carl Eugen
>
> Doing that now would break EVERY API user.

As opposed to causing trouble only to those users who happen
to run libavcodec on a new Intel cpu? We seem to disagree
which is worse...
Anyway, since we had no release since the last bump, we
could simply bump again if this change has any advantage.

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


Re: [FFmpeg-devel] [RFC]Use ptrdiff_t for linesize and stride

2018-01-12 Thread wm4
On Sat, 13 Jan 2018 02:46:51 +0100
Carl Eugen Hoyos  wrote:

> Hi!
> 
> Seeing 6e80079a it appears that the unstable period is not over yet.
> Vittorio posted a patch that introduces a temporary type to avoid
> breaking API, but that may not be relevant if the api currently
> unstable.
> 
> Attached patch (inspired by Vittorio's RFC) passes fate with
> --disable-asm and does not introduce new warnings with gcc 6.3.
> Do we generally need this change?
> Do we generally want it?
> 
> If yes, I will likely need help for the asm changes.
> 
> I would like to avoid a temporary type and I would like to avoid a
> future version bump only because this change suddenly becomes
> necessary.
> 
> Please comment, Carl Eugen

Doing that now would break EVERY API user.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [RFC]Use ptrdiff_t for linesize and stride

2018-01-12 Thread Carl Eugen Hoyos
Hi!

Seeing 6e80079a it appears that the unstable period is not over yet.
Vittorio posted a patch that introduces a temporary type to avoid
breaking API, but that may not be relevant if the api currently
unstable.

Attached patch (inspired by Vittorio's RFC) passes fate with
--disable-asm and does not introduce new warnings with gcc 6.3.
Do we generally need this change?
Do we generally want it?

If yes, I will likely need help for the asm changes.

I would like to avoid a temporary type and I would like to avoid a
future version bump only because this change suddenly becomes
necessary.

Please comment, Carl Eugen
From 8846f6e0a773937c441834ccaf7774fd2415d8b7 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sat, 13 Jan 2018 02:32:45 +0100
Subject: [PATCH] Use ptrdiff_t for linesize.

---
 libavcodec/avcodec.h  |4 +-
 libavcodec/cinepakenc.c   |   42 ++--
 libavcodec/decode.c   |2 +-
 libavcodec/error_resilience.c |8 +--
 libavcodec/ffv1dec_template.c |2 +-
 libavcodec/ffv1enc.c  |2 +-
 libavcodec/ffv1enc_template.c |2 +-
 libavcodec/h264_loopfilter.c  |6 +-
 libavcodec/h264dec.c  |2 +-
 libavcodec/h264dec.h  |6 +-
 libavcodec/internal.h |2 +-
 libavcodec/mpegvideo_enc.c|3 +-
 libavcodec/mpegvideoencdsp.c  |   12 ++--
 libavcodec/mpegvideoencdsp.h  |4 +-
 libavcodec/nuv.c  |2 +-
 libavcodec/nvenc.c|2 +-
 libavcodec/roqvideoenc.c  |4 +-
 libavcodec/smvjpegdec.c   |4 +-
 libavcodec/utvideoenc.c   |2 +-
 libavdevice/sdl2.c|2 +-
 libavdevice/xv.c  |6 +-
 libavfilter/avf_showcqt.c |2 +-
 libavfilter/drawutils.c   |   14 ++--
 libavfilter/drawutils.h   |   12 ++--
 libavfilter/framepool.c   |2 +-
 libavfilter/lavfutils.c   |2 +-
 libavfilter/lavfutils.h   |2 +-
 libavfilter/lswsutils.c   |4 +-
 libavfilter/lswsutils.h   |4 +-
 libavfilter/maskedmerge.h |2 +-
 libavfilter/tinterlace.h  |2 +-
 libavfilter/vf_detelecine.c   |2 +-
 libavfilter/vf_extractplanes.c|2 +-
 libavfilter/vf_fieldhint.c|2 +-
 libavfilter/vf_fieldmatch.c   |4 +-
 libavfilter/vf_fieldorder.c   |2 +-
 libavfilter/vf_framepack.c|2 +-
 libavfilter/vf_il.c   |2 +-
 libavfilter/vf_kerndeint.c|4 +-
 libavfilter/vf_limiter.c  |2 +-
 libavfilter/vf_maskedclamp.c  |2 +-
 libavfilter/vf_mix.c  |2 +-
 libavfilter/vf_neighbor.c |2 +-
 libavfilter/vf_nnedi.c|4 +-
 libavfilter/vf_noise.h|2 +-
 libavfilter/vf_perspective.c  |2 +-
 libavfilter/vf_phase.c|2 +-
 libavfilter/vf_premultiply.c  |2 +-
 libavfilter/vf_pseudocolor.c  |2 +-
 libavfilter/vf_psnr.c |4 +-
 libavfilter/vf_pullup.h   |2 +-
 libavfilter/vf_removelogo.c   |2 +-
 libavfilter/vf_repeatfields.c |2 +-
 libavfilter/vf_sab.c  |8 +--
 libavfilter/vf_scale.c|2 +-
 libavfilter/vf_shuffleplanes.c|2 +-
 libavfilter/vf_smartblur.c|8 +--
 libavfilter/vf_stack.c|2 +-
 libavfilter/vf_stereo3d.c |2 +-
 libavfilter/vf_telecine.c |2 +-
 libavfilter/vf_tinterlace.c   |4 +-
 libavfilter/vf_uspp.c |2 +-
 libavfilter/vf_w3fdif.c   |2 +-
 libavfilter/vf_weave.c|2 +-
 libavfilter/vsrc_mptestsrc.c  |4 +-
 libavformat/uncodedframecrcenc.c  |2 +-
 libavutil/attributes.h|2 +
 libavutil/audio_fifo.c|5 +-
 libavutil/frame.h |2 +-
 libavutil/hwcontext_vdpau.c   |4 +-
 libavutil/imgutils.c  |   25 +++
 libavutil/imgutils.h  |   18 ++---
 libavutil/pixdesc.c   |6 +-
 libavutil/pixdesc.h   |5 +-
 libavutil/samplefmt.c |   11 +--
 libavutil/samplefmt.h |8 +--
 libpostproc/postprocess.c |4 +-
 libpostproc/postprocess.h |4 +-
 libswscale/alphablend.c   |4 +-
 libswscale/slice.c|2 +-
 libswscale/swscale.c  |   17 ++---
 libswscale/swscale.h  |4 +-
 libswscale/swscale_internal.h |   14 ++--
 libswscale/swscale_unscaled.c |  136 ++---
 libswscale/x86/yuv2rgb_template.c |   32 -
 libswscale/yuv2rgb.c  |4 +-
 tests/api/api-band-test.c |2 +-
 tests/api/api-h264-test.c |2 +-
 tests/api/api-seek-test.c |2 +-
 89 files changed, 290 insertions(+), 282 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
i

[FFmpeg-devel] [PATCH] lavfi/vf_scale_vaapi: set output SAR

2018-01-12 Thread Rodger Combs
---
 libavfilter/vf_scale_vaapi.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 22e928c..4bead5a 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -240,6 +240,11 @@ static int scale_vaapi_config_output(AVFilterLink *outlink)
 goto fail;
 }
 
+if (inlink->sample_aspect_ratio.num)
+outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * 
inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio);
+else
+outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
+
 av_freep(&hwconfig);
 av_hwframe_constraints_free(&constraints);
 return 0;
-- 
2.6.4

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


Re: [FFmpeg-devel] [PATCH] add dumpwave filter

2018-01-12 Thread Дмитрий Гуменюк
Hi

> On 12 Jan 2018, at 13:32, Дмитрий Гуменюк  wrote:
> 
>> On 12 Jan 2018, at 13:17, Tobias Rapp > > wrote:
>> 
>> On 12.01.2018 12:16, Дмитрий Гуменюк wrote:
>>> Hi
 On 11 Jan 2018, at 09:20, Tobias Rapp >>> > wrote:
 
 On 10.01.2018 18:18, Kyle Swanson wrote:
> Hi,
> For this to be a part of libavfilter the output needs to be more generic
> than the just the Soundcloud format. If we want this to be generally 
> useful
> it should probably just output an array of floats between 0.0 and 1.0. The
> consumer of this data (JS library, or whatever) can use this in whatever
> way it wants.
 
 I agree. If the BWF Peak Envelope output which was suggested in the other 
 thread does not match your demands and filter implementation is actually 
 necessary I would prefer if the filter would attach the RMS value(s) as 
 frame metadata instead of directly dumping to file. Frame metadata can 
 then be re-
>>> RMS values may be counted for several frames or only for a half of a frame
 used by other filters or dumped into file by using the existing 
 "ametadata" filter.
 
 This would be similar to:
 
 ffmpeg -i input-file -f null -filter:a 
 "asetnsamples=22050,astats=metadata=on,ametadata=print:file=stats-file.dat"
  /dev/null
>>> I like this idea, but won’t asetnsamples affect performance by creating 
>>> fifo queue? And it may require some effort to parse long output
>> 
>> I added asetnsamples to define the audio frame size (interval of values from 
>> astats). You can reduce the number of lines printed by ametadata by using 
>> the "key=lavfi.astats.foo" option.
> I used asetnsamples as well, and I measured performance while transcoding - 
> it appears to be slight slower
I think output is now more generic and I got rid of long switch/case, thanks 
for support 

>> 
>> Regards,
>> Tobias
>> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org 
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel 
>> 

smime.p7s
Description: S/MIME cryptographic signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/dcaenc: Use ffmpeg mdct instead of own implementation

2018-01-12 Thread Даниил Чередник
New path attached.

Thanks.

On Sat, Jan 13, 2018 at 2:37 AM, James Almer  wrote:

> On 1/12/2018 8:12 PM, Даниил Чередник wrote:
> > Hysterically dcaenc uses own implementation of time->frequency
> > transformation used by psychoacoustic. But actually function named fft in
> > original dcaenc code is not fft. Power spectrum looks similar to mdct,
> and
> > Alexander E. Patrakov told me it is MDCT. But for me it is still a bit
> > strange, because of output size, and absent phase shift sensitivity. I
> was
> > thinking about MCLT. But again, result of transformation original
> function
> > was different. So I decided to use ffmpeg mdct transformation here.
> >
> >
> > Results:
> >
> > I could not hear the difference between original and modified version.
> >
> > I got approximately 10% performance boost.
>
>
> > From 39e7f15886f1c083f3a3d37d52778882c8949a93 Mon Sep 17 00:00:00 2001
> > From: Daniil Cherednik 
> > Date: Sun, 7 Jan 2018 22:39:22 +
> > Subject: [PATCH] avcodec/dcaenc: Use ffmpeg mdct instead of own
> implementation
> >
> > Signed-off-by: Daniil Cherednik 
> > ---
> >  libavcodec/dcaenc.c   | 107 ++
> 
> >  tests/fate/acodec.mak |   4 +-
> >  2 files changed, 32 insertions(+), 79 deletions(-)
> >
> > diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
> > index dd601ffae0..b924c58185 100644
> > --- a/libavcodec/dcaenc.c
> > +++ b/libavcodec/dcaenc.c
> > @@ -21,6 +21,9 @@
> >   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA
> >   */
> >
> > +#define FFT_FLOAT 0
> > +#define FFT_FIXED_32 1
> > +
> >  #include "libavutil/avassert.h"
> >  #include "libavutil/channel_layout.h"
> >  #include "libavutil/common.h"
> > @@ -33,6 +36,7 @@
> >  #include "dca_core.h"
> >  #include "dcadata.h"
> >  #include "dcaenc.h"
> > +#include "fft.h"
> >  #include "internal.h"
> >  #include "mathops.h"
> >  #include "put_bits.h"
> > @@ -56,6 +60,7 @@ typedef struct DCAEncContext {
> >  AVClass *class;
> >  PutBitContext pb;
> >  DCAADPCMEncContext adpcm_ctx;
> > +FFTContext mdct;
> >  CompressionOptions options;
> >  int frame_size;
> >  int frame_bits;
> > @@ -154,6 +159,7 @@ static int encode_init(AVCodecContext *avctx)
> >  DCAEncContext *c = avctx->priv_data;
> >  uint64_t layout = avctx->channel_layout;
> >  int i, j, min_frame_bits;
> > +int rv;
>
> We normally use ret for variables meant to hold a return value.
>
> >
> >  if (subband_bufer_alloc(c))
> >  return AVERROR(ENOMEM);
> > @@ -231,6 +237,9 @@ static int encode_init(AVCodecContext *avctx)
> >
> >  avctx->frame_size = 32 * SUBBAND_SAMPLES;
> >
> > +if ((rv = ff_mdct_init(&c->mdct, 9, 0, 1.0)) < 0)
> > +return rv;
> > +
> >  if (!cos_table[0]) {
> >  int j, k;
> >
> > @@ -297,6 +306,7 @@ static av_cold int encode_close(AVCodecContext
> *avctx)
> >  {
> >  if (avctx->priv_data) {
> >  DCAEncContext *c = avctx->priv_data;
> > +ff_mdct_end(&c->mdct);
> >  subband_bufer_free(c);
> >  ff_dcaadpcm_free(&c->adpcm_ctx);
> >  }
> > @@ -398,78 +408,6 @@ static void lfe_downsample(DCAEncContext *c, const
> int32_t *input)
> >  }
> >  }
> >
> > -typedef struct {
> > -int32_t re;
> > -int32_t im;
> > -} cplx32;
> > -
> > -static void fft(const int32_t in[2 * 256], cplx32 out[256])
> > -{
> > -cplx32 buf[256], rin[256], rout[256];
> > -int i, j, k, l;
> > -
> > -/* do two transforms in parallel */
> > -for (i = 0; i < 256; i++) {
> > -/* Apply the Hann window */
> > -rin[i].re = mul32(in[2 * i], 0x3fff - (cos_t(8 * i + 2) >>
> 1));
> > -rin[i].im = mul32(in[2 * i + 1], 0x3fff - (cos_t(8 * i + 6)
> >> 1));
> > -}
> > -/* pre-rotation */
> > -for (i = 0; i < 256; i++) {
> > -buf[i].re = mul32(cos_t(4 * i + 2), rin[i].re)
> > -  - mul32(sin_t(4 * i + 2), rin[i].im);
> > -buf[i].im = mul32(cos_t(4 * i + 2), rin[i].im)
> > -  + mul32(sin_t(4 * i + 2), rin[i].re);
> > -}
> > -
> > -for (j = 256, l = 1; j != 1; j >>= 1, l <<= 1) {
> > -for (k = 0; k < 256; k += j) {
> > -for (i = k; i < k + j / 2; i++) {
> > -cplx32 sum, diff;
> > -int t = 8 * l * i;
> > -
> > -sum.re = buf[i].re + buf[i + j / 2].re;
> > -sum.im = buf[i].im + buf[i + j / 2].im;
> > -
> > -diff.re = buf[i].re - buf[i + j / 2].re;
> > -diff.im = buf[i].im - buf[i + j / 2].im;
> > -
> > -buf[i].re = half32(sum.re);
> > -buf[i].im = half32(sum.im);
> > -
> > -buf[i + j / 2].re = mul32(diff.re, cos_t(t))
> > -  - mul32(diff.im, sin_t(t));
> > -buf[i + j / 2].im = mul32(diff.im, cos_t(t))
> > -  + mul32(diff.re, sin_t(t));
> > -}

Re: [FFmpeg-devel] [PATCH] avcodec/dcaenc: Use ffmpeg mdct instead of own implementation

2018-01-12 Thread James Almer
On 1/12/2018 8:12 PM, Даниил Чередник wrote:
> Hysterically dcaenc uses own implementation of time->frequency
> transformation used by psychoacoustic. But actually function named fft in
> original dcaenc code is not fft. Power spectrum looks similar to mdct, and
> Alexander E. Patrakov told me it is MDCT. But for me it is still a bit
> strange, because of output size, and absent phase shift sensitivity. I was
> thinking about MCLT. But again, result of transformation original function
> was different. So I decided to use ffmpeg mdct transformation here.
> 
> 
> Results:
> 
> I could not hear the difference between original and modified version.
> 
> I got approximately 10% performance boost.


> From 39e7f15886f1c083f3a3d37d52778882c8949a93 Mon Sep 17 00:00:00 2001
> From: Daniil Cherednik 
> Date: Sun, 7 Jan 2018 22:39:22 +
> Subject: [PATCH] avcodec/dcaenc: Use ffmpeg mdct instead of own implementation
> 
> Signed-off-by: Daniil Cherednik 
> ---
>  libavcodec/dcaenc.c   | 107 
> ++
>  tests/fate/acodec.mak |   4 +-
>  2 files changed, 32 insertions(+), 79 deletions(-)
> 
> diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
> index dd601ffae0..b924c58185 100644
> --- a/libavcodec/dcaenc.c
> +++ b/libavcodec/dcaenc.c
> @@ -21,6 +21,9 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>  
> +#define FFT_FLOAT 0
> +#define FFT_FIXED_32 1
> +
>  #include "libavutil/avassert.h"
>  #include "libavutil/channel_layout.h"
>  #include "libavutil/common.h"
> @@ -33,6 +36,7 @@
>  #include "dca_core.h"
>  #include "dcadata.h"
>  #include "dcaenc.h"
> +#include "fft.h"
>  #include "internal.h"
>  #include "mathops.h"
>  #include "put_bits.h"
> @@ -56,6 +60,7 @@ typedef struct DCAEncContext {
>  AVClass *class;
>  PutBitContext pb;
>  DCAADPCMEncContext adpcm_ctx;
> +FFTContext mdct;
>  CompressionOptions options;
>  int frame_size;
>  int frame_bits;
> @@ -154,6 +159,7 @@ static int encode_init(AVCodecContext *avctx)
>  DCAEncContext *c = avctx->priv_data;
>  uint64_t layout = avctx->channel_layout;
>  int i, j, min_frame_bits;
> +int rv;

We normally use ret for variables meant to hold a return value.

>  
>  if (subband_bufer_alloc(c))
>  return AVERROR(ENOMEM);
> @@ -231,6 +237,9 @@ static int encode_init(AVCodecContext *avctx)
>  
>  avctx->frame_size = 32 * SUBBAND_SAMPLES;
>  
> +if ((rv = ff_mdct_init(&c->mdct, 9, 0, 1.0)) < 0)
> +return rv;
> +
>  if (!cos_table[0]) {
>  int j, k;
>  
> @@ -297,6 +306,7 @@ static av_cold int encode_close(AVCodecContext *avctx)
>  {
>  if (avctx->priv_data) {
>  DCAEncContext *c = avctx->priv_data;
> +ff_mdct_end(&c->mdct);
>  subband_bufer_free(c);
>  ff_dcaadpcm_free(&c->adpcm_ctx);
>  }
> @@ -398,78 +408,6 @@ static void lfe_downsample(DCAEncContext *c, const 
> int32_t *input)
>  }
>  }
>  
> -typedef struct {
> -int32_t re;
> -int32_t im;
> -} cplx32;
> -
> -static void fft(const int32_t in[2 * 256], cplx32 out[256])
> -{
> -cplx32 buf[256], rin[256], rout[256];
> -int i, j, k, l;
> -
> -/* do two transforms in parallel */
> -for (i = 0; i < 256; i++) {
> -/* Apply the Hann window */
> -rin[i].re = mul32(in[2 * i], 0x3fff - (cos_t(8 * i + 2) >> 1));
> -rin[i].im = mul32(in[2 * i + 1], 0x3fff - (cos_t(8 * i + 6) >> 
> 1));
> -}
> -/* pre-rotation */
> -for (i = 0; i < 256; i++) {
> -buf[i].re = mul32(cos_t(4 * i + 2), rin[i].re)
> -  - mul32(sin_t(4 * i + 2), rin[i].im);
> -buf[i].im = mul32(cos_t(4 * i + 2), rin[i].im)
> -  + mul32(sin_t(4 * i + 2), rin[i].re);
> -}
> -
> -for (j = 256, l = 1; j != 1; j >>= 1, l <<= 1) {
> -for (k = 0; k < 256; k += j) {
> -for (i = k; i < k + j / 2; i++) {
> -cplx32 sum, diff;
> -int t = 8 * l * i;
> -
> -sum.re = buf[i].re + buf[i + j / 2].re;
> -sum.im = buf[i].im + buf[i + j / 2].im;
> -
> -diff.re = buf[i].re - buf[i + j / 2].re;
> -diff.im = buf[i].im - buf[i + j / 2].im;
> -
> -buf[i].re = half32(sum.re);
> -buf[i].im = half32(sum.im);
> -
> -buf[i + j / 2].re = mul32(diff.re, cos_t(t))
> -  - mul32(diff.im, sin_t(t));
> -buf[i + j / 2].im = mul32(diff.im, cos_t(t))
> -  + mul32(diff.re, sin_t(t));
> -}
> -}
> -}
> -/* post-rotation */
> -for (i = 0; i < 256; i++) {
> -int b = ff_reverse[i];
> -rout[i].re = mul32(buf[b].re, cos_t(4 * i))
> -   - mul32(buf[b].im, sin_t(4 * i));
> -rout[i].im = mul32(buf[b].im, cos_t(4 * i))
> -   + mul32(buf[b].re, sin_t(4 * i));

[FFmpeg-devel] [PATCH] avcodec/dcaenc: Use ffmpeg mdct instead of own implementation

2018-01-12 Thread Даниил Чередник
Hysterically dcaenc uses own implementation of time->frequency
transformation used by psychoacoustic. But actually function named fft in
original dcaenc code is not fft. Power spectrum looks similar to mdct, and
Alexander E. Patrakov told me it is MDCT. But for me it is still a bit
strange, because of output size, and absent phase shift sensitivity. I was
thinking about MCLT. But again, result of transformation original function
was different. So I decided to use ffmpeg mdct transformation here.


Results:

I could not hear the difference between original and modified version.

I got approximately 10% performance boost.

-- 
Daniil Cherednik


0001-avcodec-dcaenc-Use-ffmpeg-mdct-instead-of-own-implem.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] avfilter: add dumpwave filter.

2018-01-12 Thread Дмитрий Гуменюк
Hi
One more thing regarding asetnsamples->metadata I think it would be hard to set 
up 2 chains of them for getting 2 different “resolutions" at the same time
> On 12 Jan 2018, at 08:36, Kyle Swanson  wrote:
> 
> Hi,
> 
> Make sure you go back and read our comments. There were several things you
> didn't address in your most recent patch.
> 
> Thanks,
> Kyle
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From d15553e52b9723651bb368264d86d0c5ec414f7a Mon Sep 17 00:00:00 2001
From: Dmytro Humeniuk 
Date: Fri, 12 Jan 2018 23:48:23 +0100
Subject: [PATCH] avfilter: add dumpwave filter.

Signed-off-by: Dmytro Humeniuk 
---
 Changelog|   1 +
 doc/filters.texi |  22 
 libavfilter/Makefile |   1 +
 libavfilter/af_dumpwave.c| 233 +++
 libavfilter/allfilters.c |   1 +
 libavfilter/version.h|   4 +-
 tests/fate/filter-audio.mak  |  13 ++
 tests/ref/fate/filter-dumpwave   |   1 +
 tests/ref/fate/filter-dumpwave-24bit |   1 +
 tests/ref/fate/filter-dumpwave-fltp  |   1 +
 10 files changed, 276 insertions(+), 2 deletions(-)
 create mode 100644 libavfilter/af_dumpwave.c
 create mode 100644 tests/ref/fate/filter-dumpwave
 create mode 100644 tests/ref/fate/filter-dumpwave-24bit
 create mode 100644 tests/ref/fate/filter-dumpwave-fltp

diff --git a/Changelog b/Changelog
index 61075b3392..40fd624449 100644
--- a/Changelog
+++ b/Changelog
@@ -38,6 +38,7 @@ version :
 - Removed the ffserver program
 - Removed the ffmenc and ffmdec muxer and demuxer
 - VideoToolbox HEVC encoder and hwaccel
+- dumpwave audio filter
 
 
 version 3.4:
diff --git a/doc/filters.texi b/doc/filters.texi
index bd93e0ab84..bd49a8ec91 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2538,6 +2538,28 @@ Optional. It should have a value much less than 1 (e.g. 
0.05 or 0.02) and is
 used to prevent clipping.
 @end table
 
+@section dumpwave
+Dump RMS envelope to a file.
+Convert samples to decibels and calculates RMS (Root-Mean-Square) audio power 
in 0 to 1.0 floats.
+
+@table @option
+@item w, width
+Number of data values.
+The default value is @var{1800}
+
+@item n, nb_samples
+Samples count per value per channel, default 128
+
+@item f, file
+Path to a file
+@end table
+
+For example, to generate RMS envelope for 44.1 kHz 6 seconds length audio
+with dimensions @var{1800x140}, samples count @code{44100*6/1800=147} and 
store it to @var{/tmp/out.csv}, you might use:
+@example
+dumpwave=w=1800:n=147:f=/tmp/out.csv
+@end example
+
 @section dynaudnorm
 Dynamic Audio Normalizer.
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index ef4729dd3f..2ffbc9497a 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -87,6 +87,7 @@ OBJS-$(CONFIG_COMPENSATIONDELAY_FILTER)  += 
af_compensationdelay.o
 OBJS-$(CONFIG_CROSSFEED_FILTER)  += af_crossfeed.o
 OBJS-$(CONFIG_CRYSTALIZER_FILTER)+= af_crystalizer.o
 OBJS-$(CONFIG_DCSHIFT_FILTER)+= af_dcshift.o
+OBJS-$(CONFIG_DUMPWAVE_FILTER)   += af_dumpwave.o
 OBJS-$(CONFIG_DYNAUDNORM_FILTER) += af_dynaudnorm.o
 OBJS-$(CONFIG_EARWAX_FILTER) += af_earwax.o
 OBJS-$(CONFIG_EBUR128_FILTER)+= f_ebur128.o
diff --git a/libavfilter/af_dumpwave.c b/libavfilter/af_dumpwave.c
new file mode 100644
index 00..3d1653d8de
--- /dev/null
+++ b/libavfilter/af_dumpwave.c
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2017 Dmytro Humeniuk
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * waveform audio filter – dump RMS amplitude to file
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
+#include "libavformat/avio.h"
+#include "avfilter.h"
+#include "formats.h"
+#include "audio.h"
+#include "internal.h"
+
+typedef struct DumpWaveContext {
+const AVClass *class;   /**< class for AVOptions */
+int width;  /**< number of data values */
+int idx;/**< index of current value *

Re: [FFmpeg-devel] [PATCHv2 2/2] avfilter/vf_framerate: simplify filter

2018-01-12 Thread Marton Balint



On Tue, 9 Jan 2018, Marton Balint wrote:




On Thu, 4 Jan 2018, Marton Balint wrote:


The framerate filter was quite convoluted with some filter_frame /
request_frame logic bugs. It seemed easier to rewrite the whole 

filter_frame /
request_frame part and also the frame interpolation ratio calculation part 

in

one step.

Notable changes:
- The filter now only stores 2 frames instead of 3
- filter_frame outputs all the frames it can to be able to handle 

consecutive

 filter_frame calls which previously caused early drops of buffered frames.
- because of this, request_frame is largely simplified and it only outputs
 frames on flush. Previously consecuitve request_frame calls could cause 

the
 filter to think it is in flush mode filling its buffer with the same 

frames

 causing a "ghost" effect on the output.
- PTS discontinuities are handled better
- frames with unknown PTS values are now dropped

Fixes ticket #4870.
Probably fixes ticket #5493.



Will push this soon.


Pushed.

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


[FFmpeg-devel] [PATCH] libavformat/dashdec: Fix for ticket 6856 (filename limited to 1024)

2018-01-12 Thread Colin NG
---
 libavformat/dashdec.c | 87 +--
 1 file changed, 56 insertions(+), 31 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 5345f91..7316213 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -141,6 +141,7 @@ typedef struct DASHContext {
 char *headers;   ///< holds HTTP headers set as an 
AVOption to the HTTP protocol context
 char *allowed_extensions;
 AVDictionary *avio_opts;
+int max_url_size;
 } DASHContext;
 
 static uint64_t get_current_time_in_sec(void)
@@ -153,6 +154,10 @@ static int ishttp(char *url) {
 return av_strstart(proto_name, "http", NULL);
 }
 
+static int aligned(int val) {
+return ((val + 0x3F) >> 6) << 6;
+}
+
 static uint64_t get_utc_date_time_insec(AVFormatContext *s, const char 
*datetime)
 {
 struct tm timeinfo;
@@ -424,6 +429,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, 
const char *url,
 
 static char *get_content_url(xmlNodePtr *baseurl_nodes,
  int n_baseurl_nodes,
+ int max_url_size,
  char *rep_id_val,
  char *rep_bandwidth_val,
  char *val)
@@ -431,10 +437,13 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes,
 int i;
 char *text;
 char *url = NULL;
-char tmp_str[MAX_URL_SIZE];
-char tmp_str_2[MAX_URL_SIZE];
 
-memset(tmp_str, 0, sizeof(tmp_str));
+char *tmp_str = av_mallocz(max_url_size);
+char *tmp_str_2 = av_mallocz(max_url_size);
+
+if (!tmp_str || !tmp_str_2) {
+return NULL;
+}
 
 for (i = 0; i < n_baseurl_nodes; ++i) {
 if (baseurl_nodes[i] &&
@@ -442,32 +451,35 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes,
 baseurl_nodes[i]->children->type == XML_TEXT_NODE) {
 text = xmlNodeGetContent(baseurl_nodes[i]->children);
 if (text) {
-memset(tmp_str, 0, sizeof(tmp_str));
-memset(tmp_str_2, 0, sizeof(tmp_str_2));
-ff_make_absolute_url(tmp_str_2, MAX_URL_SIZE, tmp_str, text);
-av_strlcpy(tmp_str, tmp_str_2, sizeof(tmp_str));
+memset(tmp_str, 0, max_url_size);
+memset(tmp_str_2, 0, max_url_size);
+ff_make_absolute_url(tmp_str_2, max_url_size, tmp_str, text);
+av_strlcpy(tmp_str, tmp_str_2, max_url_size);
 xmlFree(text);
 }
 }
 }
 
 if (val)
-av_strlcat(tmp_str, (const char*)val, sizeof(tmp_str));
-
+av_strlcat(tmp_str, (const char*)val, max_url_size);
 if (rep_id_val) {
 url = av_strireplace(tmp_str, "$RepresentationID$", (const 
char*)rep_id_val);
 if (!url) {
-return NULL;
+goto end;
 }
-av_strlcpy(tmp_str, url, sizeof(tmp_str));
+av_strlcpy(tmp_str, url, max_url_size);
 av_free(url);
 }
 if (rep_bandwidth_val && tmp_str[0] != '\0') {
 url = av_strireplace(tmp_str, "$Bandwidth$", (const 
char*)rep_bandwidth_val);
 if (!url) {
-return NULL;
+   goto end;
 }
 }
+
+end:
+av_free(tmp_str);
+av_free(tmp_str_2);
 return url;
 }
 
@@ -540,7 +552,7 @@ static struct fragment * get_Fragment(char *range)
 char *str_end_offset;
 char *str_offset = av_strtok(range, "-", &str_end_offset);
 seg->url_offset = strtoll(str_offset, NULL, 10);
-seg->size = strtoll(str_end_offset, NULL, 10) -seg->url_offset;
+seg->size = strtoll(str_end_offset, NULL, 10) - seg->url_offset;
 }
 
 return seg;
@@ -552,9 +564,11 @@ static int parse_manifest_segmenturlnode(AVFormatContext 
*s, struct representati
  char *rep_id_val,
  char *rep_bandwidth_val)
 {
+DASHContext *c = s->priv_data;
 char *initialization_val = NULL;
 char *media_val = NULL;
 char *range_val = NULL;
+int max_url_size = c ? c->max_url_size: MAX_URL_SIZE;
 
 if (!av_strcasecmp(fragmenturl_node->name, (const char 
*)"Initialization")) {
 initialization_val = xmlGetProp(fragmenturl_node, "sourceURL");
@@ -567,6 +581,7 @@ static int parse_manifest_segmenturlnode(AVFormatContext 
*s, struct representati
 return AVERROR(ENOMEM);
 }
 rep->init_section->url = get_content_url(baseurl_nodes, 4,
+ max_url_size,
  rep_id_val,
  rep_bandwidth_val,
  initialization_val);
@@ -591,6 +606,7 @@ static int parse_manifest_segmenturlnode(AVFormatContext 
*s, struct representati
 return AVERROR(ENOMEM);
 

Re: [FFmpeg-devel] [PATCH 1/3] avcodec/utils: Avoid hardcoding duplicated types in sizeof()

2018-01-12 Thread Michael Niedermayer
On Sun, Jun 04, 2017 at 02:25:44AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/utils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

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

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


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


Re: [FFmpeg-devel] [PATCH] avcodec/opus: Add {} over multiline if() body

2018-01-12 Thread Michael Niedermayer
On Wed, Jan 03, 2018 at 01:34:59AM +, Rostislav Pehlivanov wrote:
> On 2 January 2018 at 22:34, Michael Niedermayer 
> wrote:
> 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/opus.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/opus.c b/libavcodec/opus.c
> > index 9cbf4aed92..d00a17a7f1 100644
> > --- a/libavcodec/opus.c
> > +++ b/libavcodec/opus.c
> > @@ -566,12 +566,12 @@ void ff_celt_bitalloc(CeltFrame *f, OpusRangeCoder
> > *rc, int encode)
> >  int bits2[CELT_MAX_BANDS];
> >
> >  /* Spread */
> > -if (opus_rc_tell(rc) + 4 <= f->framebits)
> > +if (opus_rc_tell(rc) + 4 <= f->framebits) {
> >  if (encode)
> >  ff_opus_rc_enc_cdf(rc, f->spread, ff_celt_model_spread);
> >  else
> >  f->spread = ff_opus_rc_dec_cdf(rc, ff_celt_model_spread);
> > -else
> > +} else
> >  f->spread = CELT_SPREAD_NORMAL;
> >
> >  /* Initialize static allocation caps */
> > --
> > 2.15.1
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> Add brackets after the } else and it'll look good to me.

will apply with that change

thx

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

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


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


Re: [FFmpeg-devel] [PATCH] avcodec/arm/sbrdsp_neon: Use a free register instead of putting 2 things in one

2018-01-12 Thread Michael Niedermayer
On Fri, Jan 12, 2018 at 11:47:32AM -0800, Dale Curtis wrote:
> lgtm, resolves the issue on our end.

will apply

thanks

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


Re: [FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision Open SRT protocol

2018-01-12 Thread Michael Niedermayer
On Wed, Dec 13, 2017 at 03:31:04PM +0700, Nablet Developer wrote:
[...]

> @@ -3145,6 +3147,8 @@ libsmbclient_protocol_deps="libsmbclient gplv3"
>  libssh_protocol_deps="libssh"
>  mmsh_protocol_select="http_protocol"
>  mmst_protocol_select="network"
> +opensrt_protocol_select="network"
> +opensrt_protocol_deps="opensrt"
>  rtmp_protocol_conflict="librtmp_protocol"
>  rtmp_protocol_select="tcp_protocol"
>  rtmp_protocol_suggest="zlib"
> @@ -5972,6 +5976,8 @@ enabled omx   && require_header OMX_Core.h
>  enabled omx_rpi   && { check_header OMX_Core.h ||
> { ! enabled cross_compile && add_cflags 
> -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
> die "ERROR: OpenMAX IL headers not found"; } 
> && enable omx
> +#enabled opensrt   && check_lib srt srt/srt.h srt_socket -lsrt

this is commented out ?

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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


[FFmpeg-devel] [PATCH] avformat: add option to parse/store ID3 PRIV tags in metadata.

2018-01-12 Thread rshaffer
From: Richard Shaffer 

Enables getting access to ID3 PRIV tags from the command-line or metadata API
when demuxing. The PRIV owner is stored as the metadata key, and the data is
stored as the metadata value. As PRIV tags may contain arbitrary data, non-
printable characters, including NULL bytes, are escaped as \xXX.

As this introduces a change in behavior, it must be enabled by setting the
'id3v2_parse_priv' option.
---

I want to be able to expose PRIV tags using an existing API, but not sure if
this is the best approach. In particular, PRIV data may be of any type, while
metadata (and the AVDictionary type it uses) expresses values as strings. Any
feedback on the approach or specifics would be much appreciated, especially if
there is a suggestion for a better way to accomplish this.

-Richard

 libavformat/aacdec.c | 40 +++-
 libavformat/id3v2.c  | 40 
 libavformat/id3v2.h  | 13 +
 libavformat/mp3dec.c |  2 ++
 libavformat/utils.c  |  4 
 5 files changed, 90 insertions(+), 9 deletions(-)

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 36d558ff54..46e10f34af 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -21,6 +21,7 @@
  */
 
 #include "libavutil/intreadwrite.h"
+#include "libavutil/opt.h"
 #include "avformat.h"
 #include "internal.h"
 #include "id3v1.h"
@@ -28,6 +29,11 @@
 
 #define ADTS_HEADER_SIZE 7
 
+typedef struct AACDemuxContext {
+AVClass *class;
+int id3v2_parse_priv;
+} AACDemuxContext;
+
 static int adts_aac_probe(AVProbeData *p)
 {
 int max_frames = 0, first_frames = 0;
@@ -146,14 +152,30 @@ static int adts_aac_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 return ret;
 }
 
+static const AVOption aac_options[] = {
+{ "id3v2_parse_priv",
+"parse ID3v2 PRIV tags", offsetof(AACDemuxContext, id3v2_parse_priv),
+AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
+{ NULL },
+};
+
+static const AVClass aac_class = {
+.class_name = "aac",
+.item_name  = av_default_item_name,
+.option = aac_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
 AVInputFormat ff_aac_demuxer = {
-.name = "aac",
-.long_name= NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio 
Coding)"),
-.read_probe   = adts_aac_probe,
-.read_header  = adts_aac_read_header,
-.read_packet  = adts_aac_read_packet,
-.flags= AVFMT_GENERIC_INDEX,
-.extensions   = "aac",
-.mime_type= "audio/aac,audio/aacp,audio/x-aac",
-.raw_codec_id = AV_CODEC_ID_AAC,
+.name   = "aac",
+.long_name  = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio 
Coding)"),
+.read_probe = adts_aac_probe,
+.read_header= adts_aac_read_header,
+.read_packet= adts_aac_read_packet,
+.flags  = AVFMT_GENERIC_INDEX,
+.priv_class = &aac_class,
+.priv_data_size = sizeof(AACDemuxContext),
+.extensions = "aac",
+.mime_type  = "audio/aac,audio/aacp,audio/x-aac",
+.raw_codec_id   = AV_CODEC_ID_AAC,
 };
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 6c216ba7a2..dd151dd7f2 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -33,6 +33,7 @@
 #endif
 
 #include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
 #include "libavutil/dict.h"
 #include "libavutil/intreadwrite.h"
 #include "avio_internal.h"
@@ -1224,3 +1225,42 @@ end:
 av_freep(&chapters);
 return ret;
 }
+
+int ff_id3v2_parse_priv_dict(AVDictionary **metadata, ID3v2ExtraMeta 
**extra_meta)
+{
+ID3v2ExtraMeta *cur;
+int dict_flags = AV_DICT_DONT_OVERWRITE | AV_DICT_DONT_STRDUP_VAL;
+
+for (cur = *extra_meta; cur; cur = cur->next) {
+if (!strcmp(cur->tag, "PRIV")) {
+ID3v2ExtraMetaPRIV *priv = cur->data;
+AVBPrint bprint;
+char * escaped;
+int i, ret;
+
+av_bprint_init(&bprint, priv->datasize + sizeof(char), 
AV_BPRINT_SIZE_UNLIMITED);
+
+for (i = 0; i < priv->datasize; i++) {
+if (priv->data[i] < 32 || priv->data[i] > 126) {
+av_bprintf(&bprint, "\\x%02x", priv->data[i]);
+} else if (priv->data[i] == '\\') {
+av_bprint_chars(&bprint, '\\', 2);
+} else {
+av_bprint_chars(&bprint, priv->data[i], 1);
+}
+}
+
+if ((ret = av_bprint_finalize(&bprint, &escaped)) < 0)
+return ret;
+
+av_dict_set(metadata, priv->owner, escaped, dict_flags);
+}
+}
+
+return 0;
+}
+
+int ff_id3v2_parse_priv(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
+{
+return ff_id3v2_parse_priv_dict(&s->metadata, extra_meta);
+}
\ No newline at end of file
diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h
index 5e64ead096..5f46a46115 100644
--- a/libavformat/id3v2.h
+++ b/libavformat/id3v2.h
@@ 

Re: [FFmpeg-devel] [PATCH 2/3] Add muxer/demuxer for raw codec2 and .c2 files

2018-01-12 Thread Michael Niedermayer
On Sat, Dec 23, 2017 at 11:15:35PM +0100, Tomas Härdin wrote:
> 

[...]
> +static int codec2_read_header_common(AVFormatContext *s, AVStream *st)
> +{
> +int mode = avpriv_codec2_mode_from_extradata(st->codecpar->extradata);
> +
> +st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO;
> +st->codecpar->codec_id  = AV_CODEC_ID_CODEC2;
> +st->codecpar->sample_rate   = 8000;
> +st->codecpar->channels  = 1;
> +st->codecpar->format= AV_SAMPLE_FMT_S16;
> +st->codecpar->channel_layout= AV_CH_LAYOUT_MONO;
> +st->codecpar->bit_rate  = avpriv_codec2_mode_bit_rate(s, mode);
> +st->codecpar->frame_size= avpriv_codec2_mode_frame_size(s, mode);
> +st->codecpar->block_align   = avpriv_codec2_mode_block_align(s, 
> mode);
> +

> +if (st->codecpar->bit_rate <= 0 ||
> +st->codecpar->frame_size <= 0 ||
> +st->codecpar->block_align <= 0) {
> +return AVERROR(EINVAL);
> +}

This should be AVERROR_INVALIDDATA i think


> +
> +avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
> +
> +//replicating estimate_timings_from_bit_rate() in utils.c to avoid 
> warnings
> +if (s->pb && st->codecpar->bit_rate > 0) {
> +int64_t filesize = avio_size(s->pb);
> +if (filesize > s->internal->data_offset) {
> +filesize -= s->internal->data_offset;
> +st->duration = av_rescale(8 * filesize,
> +  st->time_base.den,
> +  st->codecpar->bit_rate * (int64_t) 
> st->time_base.num);
> +}
> +}

Is this exact ?
or is a calculation from frame_size / block_align more accurate ?
the most accurate one should be used


> +
> +return 0;
> +}
> +
> +static int codec2_read_header(AVFormatContext *s)
> +{
> +AVStream *st = avformat_new_stream(s, NULL);
> +int ret, version;
> +uint8_t magic[3];
> +
> +if (!st) {
> +return AVERROR(ENOMEM);
> +}
> +

> +avio_read(s->pb, magic, 3);
> +if (check_magic(magic)) {
> +av_log(s, AV_LOG_ERROR, "not a .c2 file\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
> +ret = ff_alloc_extradata(st->codecpar, AVPRIV_CODEC2_EXTRADATA_SIZE);
> +if (ret) {
> +return ret;
> +}
> +
> +avio_read(s->pb, st->codecpar->extradata, AVPRIV_CODEC2_EXTRADATA_SIZE);

The return codes from avio_read and not checked

thx

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

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


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


Re: [FFmpeg-devel] [PATCH] avcodec/arm/sbrdsp_neon: Use a free register instead of putting 2 things in one

2018-01-12 Thread Dale Curtis
lgtm, resolves the issue on our end.

- dale

On Thu, Jan 11, 2018 at 1:47 PM, Michael Niedermayer  wrote:

> Fixes high pitched shriek
> Fixes: 25420848_1478428308873746_4255813235963330560_n.mp4
>
> Reported-by: Dale Curtis 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/arm/sbrdsp_neon.S | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/arm/sbrdsp_neon.S b/libavcodec/arm/sbrdsp_neon.S
> index e66abd6..003b04e 100644
> --- a/libavcodec/arm/sbrdsp_neon.S
> +++ b/libavcodec/arm/sbrdsp_neon.S
> @@ -336,11 +336,11 @@ function ff_sbr_hf_apply_noise_0_neon, export=1
>  vld1.32 {d0}, [r0,:64]
>  vld1.32 {d6}, [lr,:64]
>  vld1.32 {d2[]},   [r1,:32]!
> -vld1.32 {d3[]},   [r2,:32]!
> +vld1.32 {d18[]},  [r2,:32]!
>  vceq.f32d4,  d2,  #0
>  veord2,  d2,  d3
>  vmovd1,  d0
> -vmla.f32d0,  d6,  d3
> +vmla.f32d0,  d6,  d18
>  vadd.f32s2,  s2,  s4
>  vbifd0,  d1,  d4
>  vst1.32 {d0}, [r0,:64]!
> --
> 2.7.4
>
> ___
> 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 2/2] lavf/tcp.c: Free allocated client URLContext in case of error.

2018-01-12 Thread Michael Niedermayer
On Fri, Jan 12, 2018 at 07:16:30PM +0100, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  libavformat/tcp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

patchset is probably ok

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.


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


Re: [FFmpeg-devel] [PATCH 06/11] decklink: Add support for using libklvanc from within capture module

2018-01-12 Thread Devin Heitmueller
Hello Marton,

Thank you for the feedback.  Comments inline.

>> +vanc_ctx->callback_context = &cb_ctx;
>> +int ret = klvanc_packet_parse(vanc_ctx, lineNr, decoded_words, 
>> sizeof(decoded_words) / (sizeof(uint16_t)));
> 
> A parity error also causes a negative return value? Or parity errors only 
> makes the library ignore the packet, and error values are meaning ENOMEM?

A parity error will cause the CRC to fail on the given packet.  Packets that 
fail the CRC check won’t invoke the callback (there is a special variable to 
override this, as well as a counter that can be inspected for the number of 
checksum errors encountered).  We don’t make any effort to distinguish between 
parity errors and checksum failures, since checksum failure already detects 
parity errors.

> 
> What happens if multiple packets are in a single line and one packet has 
> parity errors, but the other does not. We should be able to use the result 
> from the packet without errors. So does this function returns success if any 
> of the callbacks succeeded?

The klvanc_packet_parse() can invoke the callback multiple times in a single 
call, to handle cases that multiple VANC packets are found on the same line.  
The return value is the number of packets found, regardless of whether they 
failed the checksum validation or have a callback registered for their VANC 
type.

>> 
>> +#if CONFIG_LIBKLVANC
>> +int ret = klvanc_handle_line(avctx, 
>> ctx->vanc_ctx,
>> + buf, 
>> videoFrame->GetWidth(), i, &pkt);
>> +if (ret != 0)
>> +av_log(avctx, AV_LOG_ERROR, "Error parsing 
>> VANC for line %d\n", i);
>> +#else
> 
> For now, you should allow both klvanc and ffmpeg parsing of the VANC, so the 
> #else does not seem right.

I’m not against this, in particular given libklvanc doesn’t currently support 
OP47 (it’s on my todo list).  However, how do you propose we handle cases where 
functionality overlaps between the two?  In particular, we don’t want both 
klvanc and the internal routine creating EIA-708 side_data.

I’m about to leave the country for a week.  Please don’t interpret my failure 
to respond to email(s) as disinterest.  I still very much want to get this 
functionality merged (and I’ve got about a dozen patches queued up behind these 
for various features/functionality).

Devin

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


Re: [FFmpeg-devel] [PATCH 07/11] decklink: Add support for SCTE-104 to decklink capture

2018-01-12 Thread Marton Balint



On Mon, 8 Jan 2018, Devin Heitmueller wrote:


Make use of libklvanc to parse SCTE-104 packets and announce them
as a new stream.  Right now we just pass the payload straight
through, but once this is hooked into libklscte35 we'll be able
to generate SCTE-35 messages in the MPEG TS stream.

Note that this feature needs to be explicitly enabled by the user
through the "-enable_scte_104" option, since we cannot autodetect
the presence of SCTE-104 (because unlike with 708/AFD messages are
not set except when trigger occurs, thus the stream wouldn't get
created during the read_header phase).

Updated to reflect feedback from Derek Buitenhuis 
and Aaron Levinson 

Signed-off-by: Devin Heitmueller 
---
doc/indevs.texi |  4 +++
libavcodec/avcodec.h|  1 +
libavcodec/codec_desc.c |  6 
libavdevice/decklink_common.h   |  6 
libavdevice/decklink_common_c.h |  1 +
libavdevice/decklink_dec.cpp| 61 -
libavdevice/decklink_dec_c.c|  1 +
libavdevice/version.h   |  2 +-
8 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 4760d70..63dfbd4 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -323,6 +323,10 @@ Defaults to @samp{1073741824}.
Sets the audio sample bit depth. Must be @samp{16} or @samp{32}.
Defaults to @samp{16}.

+@item enable_scte_104


You can loose the "enable_" from the name if you want, some other 
boolean options don't have it. I don't mind either way.



+If set to @samp{true}, enables capture of SCTE-104 packets over SDI and
+creation of the corresponding stream at startup.  Defaults to @samp{false}.
+
@end table

@subsection Examples
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5fa028e..c61b8a1 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -668,6 +668,7 @@ enum AVCodecID {
AV_CODEC_ID_TTF = 0x18000,

AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of 
program stream.
+AV_CODEC_ID_SCTE_104,
AV_CODEC_ID_BINTEXT= 0x18800,
AV_CODEC_ID_XBIN,
AV_CODEC_ID_IDF,
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index c3688de..e198985 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -3103,6 +3103,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name  = "scte_35",
.long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"),
},
+{
+.id= AV_CODEC_ID_SCTE_104,
+.type  = AVMEDIA_TYPE_DATA,
+.name  = "scte_104",
+.long_name = NULL_IF_CONFIG_SMALL("SCTE 104 Digital Program 
Insertion"),
+},

/* deprecated codec ids */
};
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index b262780..ffc0d17 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -41,6 +41,10 @@
   Actual number for any particular model of card may be lower */
#define DECKLINK_MAX_AUDIO_CHANNELS 32

+/* This isn't actually tied to the Blackmagic hardware - it's an arbitrary
+   number used to size the array of streams */
+#define DECKLINK_MAX_DATA_STREAMS 16


As long as only SCTE is supported, you can define this to 1...


+
class decklink_output_callback;
class decklink_input_callback;

@@ -92,6 +96,8 @@ struct decklink_ctx {
unsigned int dropped;
AVStream *audio_st[DECKLINK_MAX_AUDIO_CHANNELS];
int num_audio_streams;
+AVStream *data_st[DECKLINK_MAX_DATA_STREAMS];
+int num_data_streams;
AVStream *video_st;
AVStream *teletext_st;
uint16_t cdp_sequence_num;
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 3a21bae..3f22094 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -58,6 +58,7 @@ struct decklink_cctx {
char *format_code;
int raw_format;
int64_t queue_size;
+int enable_scte_104;
};

#endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index bab3588..1074dc7 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -674,6 +674,30 @@ error:
return ret;
}

+static int setup_data(AVFormatContext *avctx)


I'd rather call this setup_data_streams.


+{
+struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
+struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
+AVStream *st;
+
+if (cctx->enable_scte_104) {
+st = avformat_new_stream(avctx, NULL);
+if (!st) {
+av_log(avctx, AV_LOG_ERROR, "Cannot add data stream\n");
+return AVERROR(ENOMEM);
+}
+st->codecpar->codec_type  = AVMEDIA_TYPE_DATA;
+st->time_base.den = ctx->bmd_tb_den;
+st->time_base.num = ctx->bmd_tb_num;
+st->codecpar->codec_id= AV_CODEC_ID_SCTE_104;
+avpriv_set_pts_info(st, 64, 1, 100);  /* 64 bits pts in us */
+ctx->data

Re: [FFmpeg-devel] [PATCH 06/11] decklink: Add support for using libklvanc from within capture module

2018-01-12 Thread Marton Balint



On Mon, 8 Jan 2018, Devin Heitmueller wrote:


Make use of libklvanc from within the DeckLink capture module,
initially for EIA-708 and AFD.  Support for other VANC types will
come in subsequent patches.

Incorporates feedback from Derek Buitenhuis ,
James Almer , and Aaron Levinson 

Signed-off-by: Devin Heitmueller 
---
libavdevice/decklink_dec.cpp | 136 +++
1 file changed, 136 insertions(+)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 6c1ff82..bab3588 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -3,6 +3,7 @@
 * Copyright (c) 2013-2014 Luca Barbato, Deti Fliegl
 * Copyright (c) 2014 Rafaël Carré
 * Copyright (c) 2017 Akamai Technologies, Inc.
+ * Copyright (c) 2017 LTN Global Communications, Inc.
 *
 * This file is part of FFmpeg.
 *
@@ -673,10 +674,123 @@ error:
return ret;
}

+#if CONFIG_LIBKLVANC
+/* VANC Callbacks */
+struct vanc_cb_ctx {
+AVFormatContext *avctx;
+AVPacket *pkt;
+};
+static int cb_AFD(void *callback_context, struct klvanc_context_s *ctx,
+  struct klvanc_packet_afd_s *pkt)
+{
+struct vanc_cb_ctx *cb_ctx = (struct vanc_cb_ctx *)callback_context;
+uint8_t *afd;
+
+afd = av_packet_new_side_data(cb_ctx->pkt, AV_PKT_DATA_AFD, 1);
+if (afd == NULL) {


if !afd
return...


+return AVERROR(ENOMEM);
+}
+afd[0] = pkt->hdr.payload[0] >> 3;
+
+return 0;
+}
+
+static int cb_EIA_708B(void *callback_context, struct klvanc_context_s *ctx,
+   struct klvanc_packet_eia_708b_s *pkt)
+{
+struct vanc_cb_ctx *cb_ctx = (struct vanc_cb_ctx *)callback_context;
+decklink_cctx *cctx = (struct decklink_cctx *)cb_ctx->avctx->priv_data;
+struct decklink_ctx *decklink_ctx = (struct decklink_ctx *)cctx->ctx;
+uint16_t expected_cdp;
+uint8_t *cc;
+
+if (!pkt->checksum_valid)
+return 0;
+
+if (!pkt->header.ccdata_present)
+return 0;
+
+expected_cdp = decklink_ctx->cdp_sequence_num + 1;
+decklink_ctx->cdp_sequence_num = pkt->header.cdp_hdr_sequence_cntr;
+if (pkt->header.cdp_hdr_sequence_cntr != expected_cdp) {
+av_log(cb_ctx->avctx, AV_LOG_DEBUG,
+   "CDP counter inconsistent.  Received=0x%04x Expected=%04x\n",
+   pkt->header.cdp_hdr_sequence_cntr, expected_cdp);
+return 0;
+}
+
+cc = av_packet_new_side_data(cb_ctx->pkt, AV_PKT_DATA_A53_CC, 
pkt->ccdata.cc_count * 3);
+if (cc == NULL)
+return AVERROR(ENOMEM);
+
+for (int i = 0; i < pkt->ccdata.cc_count; i++) {
+cc[3*i] = 0xf8 | (pkt->ccdata.cc[i].cc_valid ? 0x04 : 0x00) |
+  (pkt->ccdata.cc[i].cc_type & 0x03);
+cc[3*i+1] = pkt->ccdata.cc[i].cc_data[0];
+cc[3*i+2] = pkt->ccdata.cc[i].cc_data[1];
+}
+
+return 0;
+}
+
+static struct klvanc_callbacks_s callbacks =
+{
+cb_AFD,
+cb_EIA_708B,
+NULL,
+NULL,
+NULL,
+NULL,
+};
+/* End: VANC Callbacks */
+
+/* Take one line of V210 from VANC, colorspace convert and feed it to the
+ * VANC parser. We'll expect our VANC message callbacks to happen on this
+ * same calling thread.
+ */
+static int klvanc_handle_line(AVFormatContext *avctx, struct klvanc_context_s 
*vanc_ctx,
+  unsigned char *buf, unsigned int uiWidth, 
unsigned int lineNr,
+  AVPacket *pkt)
+{
+/* Convert the vanc line from V210 to CrCB422, then vanc parse it */
+
+/* We need two kinds of type pointers into the source vbi buffer */
+/* TODO: What the hell is this, two ptrs? */


Hmm, what?


+const uint32_t *src = (const uint32_t *)buf;
+
+/* Convert Blackmagic pixel format to nv20.
+ * src pointer gets mangled during conversion, hence we need its own
+ * ptr instead of passing vbiBufferPtr.
+ * decoded_words should be atleast 2 * uiWidth.
+ */
+uint16_t decoded_words[16384];
+
+/* On output each pixel will be decomposed into three 16-bit words (one 
for Y, U, V) */
+memset(&decoded_words[0], 0, sizeof(decoded_words));
+uint16_t *p_anc = decoded_words;
+if (klvanc_v210_line_to_nv20_c(src, p_anc, sizeof(decoded_words), (uiWidth / 
6) * 6) < 0)
+return AVERROR(EINVAL);
+
+if (vanc_ctx) {
+struct vanc_cb_ctx cb_ctx = {
+.avctx = avctx,
+.pkt = pkt
+};
+vanc_ctx->callback_context = &cb_ctx;
+int ret = klvanc_packet_parse(vanc_ctx, lineNr, decoded_words, 
sizeof(decoded_words) / (sizeof(uint16_t)));


A parity error also causes a negative return value? Or parity errors only 
makes the library ignore the packet, and error values are meaning ENOMEM?


What happens if multiple packets are in a single line and one packet has 
parity errors, but the other does not. We should be able to use the 
result from the packet without errors. So does this function returns 
success if any of the callbacks succeeded?



+

Re: [FFmpeg-devel] avcodec/utvideoenc : add SIMD (SSSE3) for sub_left_pred

2018-01-12 Thread Michael Niedermayer
On Fri, Jan 12, 2018 at 09:57:03AM +0100, Martin Vignali wrote:
> >
> > this changes the output:
> > make -j12 && ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -an -vcodec
> > utvideo -t 1 -pix_fmt yuv420p -pred left  -t 1 test2.avi
> >
> > -rw-r- 1 michael michael 3744402 Jan 12 04:20 test2.avi
> > -rw-r- 1 michael michael 3753358 Jan 12 04:19 test.avi
> >
> >
> > Hello,
> 
> Thanks for testing.
> Is it possible to have the file ?

the matrixbench file ?
thats here:
https://samples.ffmpeg.org/benchmark/testsuite1/matrixbench_mpeg2.mpg

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] [PATCH 03/11] decklink: Introduce support for capture of multiple audio streams

2018-01-12 Thread Marton Balint



On Mon, 8 Jan 2018, Devin Heitmueller wrote:


Add support for the ability to capture all audio pairs available
to the capture hardware.  Each pair is exposed as a different audio
stream, which matches up with the most common use cases for the
broadcast space (i.e. where there is one stereo pair per audio
language).

To support the existing use case where multi-channel audio can be
captured (i.e. 7.1), we introduced a new configuration option, which
defaults to the existing behavior.

Updated to reflect comments from Carl Eugen Hoyos ,
Aaron Levinson , and Matthias Hunstock
.

Signed-off-by: Devin Heitmueller 
---
doc/indevs.texi |   8 ++-
libavdevice/decklink_common.cpp |  12 
libavdevice/decklink_common.h   |   8 ++-
libavdevice/decklink_common_c.h |   6 ++
libavdevice/decklink_dec.cpp| 136 +++-
libavdevice/decklink_dec_c.c|   3 +
6 files changed, 142 insertions(+), 31 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 56066bf..4760d70 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -278,9 +278,15 @@ For SD sources, ffmpeg needs to be compiled with 
@code{--enable-libzvbi}. For
HD sources, on older (pre-4K) DeckLink card models you have to capture in 10
bit mode.

+@item audio_mode
+Defines whether to capture a bundle of audio channels (the number of which is 
determined
+by the channels argument), or whether to capture a number of audio pairs (the 
number of
+which is determined by the maximum number of pairs supported by the card).  
Must be
+@samp{bundled} or @samp{pairs}.  Defaults to @samp{bundled}.


IMHO it makes more sense to always respect the requested number of capture 
channels. If you want to capture all channels, you can define a special 
constant (e.g.: all) which maps to -1 as the number of channels, and 
modify it according to the determined number of available maximum 
channels.



+
@item channels
Defines number of audio channels to capture. Must be @samp{2}, @samp{8} or 
@samp{16}.
-Defaults to @samp{2}.
+Defaults to @samp{2}.  This parameter is ignored if audio_mode is set to pairs.

@item duplex_mode
Sets the decklink device duplex mode. Must be @samp{unset}, @samp{half} or 
@samp{full}.
diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
index c432189..e7daa63 100644
--- a/libavdevice/decklink_common.cpp
+++ b/libavdevice/decklink_common.cpp
@@ -446,6 +446,7 @@ int ff_decklink_init_device(AVFormatContext *avctx, const 
char* name)
struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data;
struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
IDeckLink *dl = NULL;
+int64_t maxAudioChannels;
IDeckLinkIterator *iter = CreateDeckLinkIteratorInstance();
if (!iter) {
av_log(avctx, AV_LOG_ERROR, "Could not create DeckLink iterator\n");
@@ -479,5 +480,16 @@ int ff_decklink_init_device(AVFormatContext *avctx, const 
char* name)
return AVERROR_EXTERNAL;
}

+if (ctx->attr->GetInt(BMDDeckLinkMaximumAudioChannels, &maxAudioChannels) 
!= S_OK) {
+av_log(avctx, AV_LOG_WARNING, "Could not determine number of audio 
channels\n");
+ctx->max_audio_channels = 0;


I think you can return failure here.


+} else {
+ctx->max_audio_channels = maxAudioChannels;
+}
+if (ctx->max_audio_channels > DECKLINK_MAX_AUDIO_CHANNELS) {
+av_log(avctx, AV_LOG_WARNING, "Decklink card reported support for more 
channels than ffmpeg supports\n");
+ctx->max_audio_channels = DECKLINK_MAX_AUDIO_CHANNELS;
+}
+
return 0;
}
diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h
index 143bbb9..b262780 100644
--- a/libavdevice/decklink_common.h
+++ b/libavdevice/decklink_common.h
@@ -37,6 +37,10 @@
#define DECKLINK_BOOL bool
#endif

+/* Maximum number of channels possible across variants of Blackmagic cards.
+   Actual number for any particular model of card may be lower */


This is actually the maximum number of channels FFMPEG supports.


+#define DECKLINK_MAX_AUDIO_CHANNELS 32
+
class decklink_output_callback;
class decklink_input_callback;

@@ -71,6 +75,7 @@ struct decklink_ctx {
int bmd_height;
int bmd_field_dominance;
int supports_vanc;
+int max_audio_channels;

/* Capture buffer queue */
AVPacketQueue queue;
@@ -85,7 +90,8 @@ struct decklink_ctx {
int64_t last_pts;
unsigned long frameCount;
unsigned int dropped;
-AVStream *audio_st;
+AVStream *audio_st[DECKLINK_MAX_AUDIO_CHANNELS];
+int num_audio_streams;
AVStream *video_st;
AVStream *teletext_st;
uint16_t cdp_sequence_num;
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 368ac25..3a21bae 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -30,6 +30,11 @@ typedef enum DecklinkPtsSource {
PTS_SRC_WALLCLOCK = 4,
} DecklinkPtsSource;

+typedef enum DecklinkAudioMode {
+AUDIO_MODE_B

Re: [FFmpeg-devel] [PATCH 02/11] decklink: Add support for output of Active Format Description (AFD)

2018-01-12 Thread Marton Balint



On Mon, 8 Jan 2018, Devin Heitmueller wrote:


Implement support for including AFD in decklink output.  This
includes making sure the AFD data is preserved when going from
an AVFrame to a V210 packet (needed for 10-bit support).

Updated to reflect feedback from Marton Balint ,
Carl Eugen Hoyos  and Aaron Levinson
.

Signed-off-by: Devin Heitmueller 
---
libavcodec/avcodec.h |  6 ++
libavcodec/v210enc.c |  8 
libavdevice/decklink_enc.cpp | 44 ++--
3 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c13deb5..5fa028e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1342,6 +1342,12 @@ enum AVPacketSideDataType {
AV_PKT_DATA_A53_CC,

/**
+ * Active Format Description data consisting of a single byte as specified
+ * in ETSI TS 101 154 using AVActiveFormatDescription enum.
+ */
+AV_PKT_DATA_AFD,
+
+/**
 * The number of side data types.
 * This is not part of the public API/ABI in the sense that it may
 * change when new side data types are added.
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index b9dcf9a..b024806 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -242,6 +242,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
memcpy(buf, side_data->data, side_data->size);
}

+side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_AFD);
+if (side_data && side_data->size) {
+uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_AFD, 
side_data->size);
+if (!buf)
+return AVERROR(ENOMEM);
+memcpy(buf, side_data->data, side_data->size);
+}
+
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index faa382a..ff60050 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -301,7 +301,8 @@ av_cold int ff_decklink_write_trailer(AVFormatContext 
*avctx)

#if CONFIG_LIBKLVANC
static int decklink_construct_vanc(AVFormatContext *avctx, struct decklink_ctx 
*ctx,
-   AVPacket *pkt, decklink_frame *frame)
+   AVPacket *pkt, decklink_frame *frame,
+   AVStream *st)
{
struct klvanc_line_set_s vanc_lines = { 0 };
int ret, size;
@@ -359,6 +360,45 @@ static int decklink_construct_vanc(AVFormatContext *avctx, 
struct decklink_ctx *
}
}



In all the error handling below, vanc_lines might need a free, because it 
might already contain buffers with a53 data, no?



+data = av_packet_get_side_data(pkt, AV_PKT_DATA_AFD, &size);
+if (data) {
+struct klvanc_packet_afd_s *pkt;
+uint16_t *afd;
+uint16_t len;
+
+ret = klvanc_create_AFD(&pkt);
+if (ret != 0)
+return AVERROR(ENOMEM);
+
+ret = klvanc_set_AFD_val(pkt, data[0]);
+if (ret != 0) {
+av_log(avctx, AV_LOG_ERROR, "Invalid AFD value specified: %d\n",
+   data[0]);
+klvanc_destroy_AFD(pkt);
+return AVERROR(EINVAL);
+}
+
+/* FIXME: Should really rely on the coded_width but seems like that
+   is not accessible to libavdevice outputs */
+if (av_cmp_q((AVRational) {st->codecpar->width, st->codecpar->height}, 
(AVRational) {4, 3}) == 1)
+pkt->aspectRatio = ASPECT_16x9;
+else
+pkt->aspectRatio = ASPECT_4x3;
+
+ret = klvanc_convert_AFD_to_words(pkt, &afd, &len);
+if (ret != 0) {
+av_log(avctx, AV_LOG_ERROR, "Failed converting 708 packet to 
words\n");
+return AVERROR(ENOMEM);
+}
+klvanc_destroy_AFD(pkt);


this destroy needs to go before the if I think.


+
+ret = klvanc_line_insert(ctx->vanc_ctx, &vanc_lines, afd, len, 12, 0);
+if (ret != 0) {
+av_log(avctx, AV_LOG_ERROR, "VANC line insertion failed\n");
+return AVERROR(ENOMEM);
+}


And you need to free afd here, no?


+}
+
IDeckLinkVideoFrameAncillary *vanc;
int result = ctx->dlo->CreateAncillaryData(bmdFormat10BitYUV, &vanc);
if (result != S_OK) {
@@ -455,7 +495,7 @@ static int decklink_write_video_packet(AVFormatContext 
*avctx, AVPacket *pkt)
frame = new decklink_frame(ctx, avpacket, st->codecpar->codec_id, 
ctx->bmd_height, ctx->bmd_width);

#if CONFIG_LIBKLVANC
-ret = decklink_construct_vanc(avctx, ctx, pkt, frame);
+ret = decklink_construct_vanc(avctx, ctx, pkt, frame, st);
if (ret != 0) {
av_log(avctx, AV_LOG_ERROR, "Failed to construct VANC\n");
}


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


[FFmpeg-devel] [PATCH 1/2] lavf/http.c: Free allocated client URLContext in case of error.

2018-01-12 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/http.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/http.c b/libavformat/http.c
index 4806b1e59b..537d0a4773 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -574,7 +574,11 @@ static int http_accept(URLContext *s, URLContext **c)
 goto fail;
 cc->hd = cl;
 cc->is_multi_client = 1;
+return 0;
 fail:
+if (c) {
+ffurl_closep(c);
+}
 return ret;
 }
 
-- 
2.15.1

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


[FFmpeg-devel] [PATCH 2/2] lavf/tcp.c: Free allocated client URLContext in case of error.

2018-01-12 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 libavformat/tcp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 8773493df1..b0289f854f 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -208,8 +208,10 @@ static int tcp_accept(URLContext *s, URLContext **c)
 return ret;
 cc = (*c)->priv_data;
 ret = ff_accept(sc->fd, sc->listen_timeout, s);
-if (ret < 0)
+if (ret < 0) {
+ffurl_closep(c);
 return ret;
+}
 cc->fd = ret;
 return 0;
 }
-- 
2.15.1

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


Re: [FFmpeg-devel] [PATCH 01/11] libavdevice/decklink: Add support for EIA-708 output over SDI

2018-01-12 Thread Marton Balint



On Mon, 8 Jan 2018, Devin Heitmueller wrote:


Hook in libklvanc and use it for output of EIA-708 captions over
SDI.  The bulk of this patch is just general support for ancillary
data for the Decklink SDI module - the real work for construction
of the EIA-708 CDP and VANC line construction is done by libklvanc.

Libklvanc can be found at: https://github.com/stoth68000/libklvanc

Updated to reflect feedback from Marton Balint ,
Carl Eugen Hoyos , and Aaron Levinson
.

Signed-off-by: Devin Heitmueller 
---
configure   |   4 +
libavcodec/v210enc.c|   9 ++
libavdevice/decklink_common.cpp |  16 +++-
libavdevice/decklink_common.h   |  10 +++
libavdevice/decklink_enc.cpp| 178 ++--
5 files changed, 206 insertions(+), 11 deletions(-)



[...]


diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index c06ca46..faa382a 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -38,17 +38,25 @@ extern "C" {

#include "decklink_common.h"
#include "decklink_enc.h"
-
+#if CONFIG_LIBKLVANC
+#include "libklvanc/vanc.h"
+#include "libklvanc/vanc-lines.h"
+#include "libklvanc/pixels.h"
+#endif

/* DeckLink callback class declaration */
class decklink_frame : public IDeckLinkVideoFrame
{
public:
decklink_frame(struct decklink_ctx *ctx, AVFrame *avframe, AVCodecID 
codec_id, int height, int width) :
-_ctx(ctx), _avframe(avframe), _avpacket(NULL), _codec_id(codec_id), 
_height(height), _width(width),  _refs(1) { }
+_ctx(ctx), _avframe(avframe), _avpacket(NULL), _codec_id(codec_id), 
_ancillary(NULL), _height(height), _width(width),  _refs(1) { }
decklink_frame(struct decklink_ctx *ctx, AVPacket *avpacket, AVCodecID 
codec_id, int height, int width) :
-_ctx(ctx), _avframe(NULL), _avpacket(avpacket), _codec_id(codec_id), 
_height(height), _width(width), _refs(1) { }
-
+_ctx(ctx), _avframe(NULL), _avpacket(avpacket), _codec_id(codec_id), 
_ancillary(NULL), _height(height), _width(width), _refs(1) { }
+virtual ~decklink_frame()
+{
+if (_ancillary)
+_ancillary->Release();
+};
virtual long   STDMETHODCALLTYPE GetWidth  (void)  { 
return _width; }
virtual long   STDMETHODCALLTYPE GetHeight (void)  { 
return _height; }
virtual long   STDMETHODCALLTYPE GetRowBytes   (void)
@@ -87,8 +95,22 @@ public:
}

virtual HRESULT STDMETHODCALLTYPE GetTimecode (BMDTimecodeFormat 
format, IDeckLinkTimecode **timecode) { return S_FALSE; }
-virtual HRESULT STDMETHODCALLTYPE 
GetAncillaryData(IDeckLinkVideoFrameAncillary **ancillary)   { 
return S_FALSE; }
-
+virtual HRESULT STDMETHODCALLTYPE 
GetAncillaryData(IDeckLinkVideoFrameAncillary **ancillary)
+{
+*ancillary = _ancillary;
+if (_ancillary) {
+_ancillary->AddRef();
+return S_OK;
+} else {
+return S_FALSE;
+}
+}
+virtual HRESULT STDMETHODCALLTYPE 
SetAncillaryData(IDeckLinkVideoFrameAncillary *ancillary)
+{
+_ancillary = ancillary;


I guess if you want to follow the existing logic, you have to 
release _ancillary here if it was already set before assigning a new 
value.



+_ancillary->AddRef();
+return S_OK;
+}
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { 
return E_NOINTERFACE; }
virtual ULONG   STDMETHODCALLTYPE AddRef(void){ 
return ++_refs; }
virtual ULONG   STDMETHODCALLTYPE Release(void)
@@ -106,6 +128,7 @@ public:
AVFrame *_avframe;
AVPacket *_avpacket;
AVCodecID _codec_id;
+IDeckLinkVideoFrameAncillary *_ancillary;
int _height;
int _width;

@@ -156,10 +179,13 @@ static int decklink_setup_video(AVFormatContext *avctx, 
AVStream *st)
   " Only AV_PIX_FMT_UYVY422 is supported.\n");
return -1;
}
+ctx->raw_format = bmdFormat8BitYUV;
} else if (c->codec_id != AV_CODEC_ID_V210) {
av_log(avctx, AV_LOG_ERROR, "Unsupported codec type!"
   " Only V210 and wrapped frame with AV_PIX_FMT_UYVY422 are 
supported.\n");
return -1;
+} else {
+ctx->raw_format = bmdFormat10BitYUV;
}

if (ff_decklink_set_configs(avctx, DIRECTION_OUT) < 0) {
@@ -173,7 +199,7 @@ static int decklink_setup_video(AVFormatContext *avctx, 
AVStream *st)
return -1;
}
if (ctx->dlo->EnableVideoOutput(ctx->bmd_mode,
-bmdVideoOutputFlagDefault) != S_OK) {
+ctx->supports_vanc ? bmdVideoOutputVANC : 
bmdVideoOutputFlagDefault) != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not enable video output!\n");
return -1;
}
@@ -264,11 +290,132 @@ av_cold int ff_decklink_write_trailer(AVFormatContext 
*avctx)
pthread_mutex_destroy(&ctx->mutex);
pthread_cond_destroy

Re: [FFmpeg-devel] avcodec/utvideoenc : add SIMD (SSSE3) for sub_left_pred

2018-01-12 Thread Henrik Gramner
On Thu, Jan 11, 2018 at 9:45 PM, Martin Vignali
 wrote:
> +if (check_func(c.sub_left_predict, "sub_left_predict")) {
> +call_ref(dst0, src0, stride, width, height);
> +call_new(dst1, src0, stride, width, height);
> +if (memcmp(dst0, dst1, width))
> +fail();
> +bench_new(dst1, src0, stride, width, height);
> +}

You're only verifying the results of the first row here. Changing it
to test all rows results in test failures.

> +int width = av_clip(rnd(), 16, 128);
> +int height = av_clip(rnd(), 16, 128);

This kind of clipping will result in the values being 128 almost every
run. You should also use constant sizes instead of random ones because
random ones will make benchmarking inconsistent since you'll measure
different things for the C and asm versions.

You could do something along the lines of

static const struct { uint8_t w, h, s; } planes[] = {
{16,16,16}, {21,23,25}, {32,17,48}, {15,128,16}, {128,127,128}
};

and just test all of those every run.

> +%if ARCH_X86_64
> +INIT_XMM ssse3
> +cglobal sub_left_predict, 4,5,5, dst, src, stride, width, height, x
> +mova m0, [pb_15] ; shuffle for last byte
> +mova m1, [pb_80] ; prev initial
> +.nextrow:
> +xor  xq, xq
> +
> +.loop:
> +movu   m2, [srcq + xq]
> +psubb  m1, m2 ; - prev
> +pslldq m3, m1, 1
> +psubb  m3, m1
> +movu[dstq+xq], m3
> +pshufb m1, m2, m0
> +addxq, mmsize
> +cmpxd, widthd
> +jl .loop
> +
> +addsrcq, strideq
> +adddstq, widthq
> +sub heightq, 1
> +jg .nextrow
> +REP_RET
> +%endif

There's no need to restrict this to x86-64 only.

The register specification is wrong and will fail on Windows (and 32-bit).

Using a constant 15 for pshufb will be be wrong for the first byte of
every row except for the first with non-mod16 widths.

Try something like this:

INIT_XMM avx
cglobal sub_left_predict, 5,6,5, dst, src, stride, width, height, x
movsxdifnidn widthq, widthd ; Change width from int to ptrdiff_t
to get rid of this
mova m1, [pb_80] ; prev
adddstq, widthq
addsrcq, widthq
lea  xd, [widthq-1]
neg  widthq
and  xd, 15
pinsrb   m4, m1, xd, 15
mov  xq, widthq

.loop:
movu m0, [srcq+widthq]
palignr  m2, m0, m1, 15
movu m1, [srcq+widthq+16]
palignr  m3, m1, m0, 15
psubbm2, m0, m2
psubbm3, m1, m3
movu [dstq+widthq], m2
movu [dstq+widthq+16], m3
add  widthq, 2*16
jl .loop

addsrcq, strideq
subdstq, xq
test xd, 16
jz .mod32
mova m1, m0
.mod32:
pshufb   m1, m4
mov  widthq, xq
dec heightd
jg .loop
RET
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 3/3] avdevice/decklink: addition of absolute wallclock option for pts source

2018-01-12 Thread Marton Balint


On Wed, 10 Jan 2018, vdi...@akamai.com wrote:


From: Vishwanath Dixit 

---
doc/indevs.texi | 6 --
libavdevice/decklink_common_c.h | 1 +
libavdevice/decklink_dec.cpp| 4 
libavdevice/decklink_dec_c.c| 1 +
4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 36aef49..0bc8e6a 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -298,11 +298,13 @@ Sets the audio input source. Must be @samp{unset}, 
@samp{embedded},

@item video_pts
Sets the video packet timestamp source. Must be @samp{video}, @samp{audio},
-@samp{reference} or @samp{wallclock}. Defaults to @samp{video}.
+@samp{reference}, @samp{wallclock} or @samp{abs_wallclock}.
+Defaults to @samp{video}.

@item audio_pts
Sets the audio packet timestamp source. Must be @samp{video}, @samp{audio},
-@samp{reference} or @samp{wallclock}. Defaults to @samp{audio}.
+@samp{reference}, @samp{wallclock} or @samp{abs_wallclock}.
+Defaults to @samp{audio}.

@item draw_bars
If set to @samp{true}, color bars are drawn in the event of a signal loss.
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 18097e2..08e9f9b 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -28,6 +28,7 @@ typedef enum DecklinkPtsSource {
PTS_SRC_VIDEO = 2,
PTS_SRC_REFERENCE = 3,
PTS_SRC_WALLCLOCK = 4,
+PTS_SRC_ABS_WALLCLOCK = 5,
PTS_SRC_NB
} DecklinkPtsSource;

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 1fd40ca..c6eea43 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -607,6 +607,8 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame 
*videoFrame,
res = videoFrame->GetHardwareReferenceTimestamp(time_base.den, 
&bmd_pts, &bmd_duration);
break;
case PTS_SRC_WALLCLOCK:
+/* fall through */
+case PTS_SRC_ABS_WALLCLOCK:
{
/* MSVC does not support compound literals like AV_TIME_BASE_Q
 * in C++ code (compiler error C4576) */
@@ -652,6 +654,8 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
ctx->frameCount++;
if (ctx->audio_pts_source == PTS_SRC_WALLCLOCK || ctx->video_pts_source == 
PTS_SRC_WALLCLOCK)
wallclock = av_gettime_relative();
+else if (ctx->audio_pts_source == PTS_SRC_ABS_WALLCLOCK || 
ctx->video_pts_source == PTS_SRC_ABS_WALLCLOCK)
+wallclock = av_gettime();


This logic is not entirely correct, the user may request abs_wallclock as 
video pts source, and wallclock as audio... So this "if" should be on its 
own assigning a different variable, (e.g. abs_wallclock) and 
you need to pass that to get_pkt_pts as well.




// Handle Video Frame
if (videoFrame) {
diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index d52dde5..00fb3af 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -70,6 +70,7 @@ static const AVOption options[] = {
{ "video", NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_VIDEO}, 0, 0, DEC, "pts_source"},
{ "reference", NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_REFERENCE}, 0, 0, DEC, "pts_source"},
{ "wallclock", NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_WALLCLOCK}, 0, 0, DEC, "pts_source"},
+{ "abs_wallclock", NULL,  0,  
AV_OPT_TYPE_CONST, { .i64 = PTS_SRC_ABS_WALLCLOCK}, 0, 0, DEC, "pts_source"},
{ "draw_bars", "draw bars on signal loss" , OFFSET(draw_bars),
AV_OPT_TYPE_BOOL,  { .i64 = 1}, 0, 1, DEC },
{ "queue_size","input queue buffer size",   OFFSET(queue_size),   
AV_OPT_TYPE_INT64, { .i64 = (1024 * 1024 * 1024)}, 0, INT64_MAX, DEC },
{ "audio_depth",   "audio bitdepth (16 or 32)", OFFSET(audio_depth),  
AV_OPT_TYPE_INT,   { .i64 = 16}, 16, 32, DEC },


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


Re: [FFmpeg-devel] [PATCH v2 1/3] avdevice/decklink: addition of copyts option

2018-01-12 Thread Marton Balint


On Wed, 10 Jan 2018, vdi...@akamai.com wrote:


From: Vishwanath Dixit 

---
doc/indevs.texi |  5 +
libavdevice/decklink_common_c.h |  1 +
libavdevice/decklink_dec.cpp| 18 +++---
libavdevice/decklink_dec_c.c|  1 +
4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 56066bf..36aef49 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -317,6 +317,11 @@ Defaults to @samp{1073741824}.
Sets the audio sample bit depth. Must be @samp{16} or @samp{32}.
Defaults to @samp{16}.

+@item decklink_copyts
+If set to @option{true}, timestamps are forwarded as they are without removing
+the initial offset.
+Defaults to @option{false}.
+
@end table

@subsection Examples
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index 368ac25..ac6563a 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -52,6 +52,7 @@ struct decklink_cctx {
char *format_code;
int raw_format;
int64_t queue_size;
+int copyts;
};

#endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 94dae26..1fd40ca 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -586,7 +586,8 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame 
*videoFrame,
   IDeckLinkAudioInputPacket *audioFrame,
   int64_t wallclock,
   DecklinkPtsSource pts_src,
-   AVRational time_base, int64_t *initial_pts)
+   AVRational time_base, int64_t *initial_pts,
+   int copyts)
{
int64_t pts = AV_NOPTS_VALUE;
BMDTimeValue bmd_pts;
@@ -619,10 +620,12 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame 
*videoFrame,
if (res == S_OK)
pts = bmd_pts / time_base.num;

-if (pts != AV_NOPTS_VALUE && *initial_pts == AV_NOPTS_VALUE)
-*initial_pts = pts;
-if (*initial_pts != AV_NOPTS_VALUE)
-pts -= *initial_pts;
+if (!copyts) {
+if (pts != AV_NOPTS_VALUE && *initial_pts == AV_NOPTS_VALUE)
+*initial_pts = pts;
+if (*initial_pts != AV_NOPTS_VALUE)
+pts -= *initial_pts;
+}

return pts;
}
@@ -635,6 +638,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
BMDTimeValue frameTime;
BMDTimeValue frameDuration;
int64_t wallclock = 0;
+struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data;

if (ctx->autodetect) {
if (videoFrame && !(videoFrame->GetFlags() & bmdFrameHasNoInputSource) 
&&
@@ -694,7 +698,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
no_video = 0;
}

-pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->video_pts_source, 
ctx->video_st->time_base, &initial_video_pts);
+pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->video_pts_source, 
ctx->video_st->time_base, &initial_video_pts, cctx->copyts);
pkt.dts = pkt.pts;

pkt.duration = frameDuration;
@@ -785,7 +789,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
pkt.size = audioFrame->GetSampleFrameCount() * 
ctx->audio_st->codecpar->channels * (ctx->audio_depth / 8);
audioFrame->GetBytes(&audioFrameBytes);
audioFrame->GetPacketTime(&audio_pts, ctx->audio_st->time_base.den);
-pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->audio_pts_source, 
ctx->audio_st->time_base, &initial_audio_pts);
+pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->audio_pts_source, 
ctx->audio_st->time_base, &initial_audio_pts, cctx->copyts);
pkt.dts = pkt.pts;

//fprintf(stderr,"Audio Frame size %d ts %d\n", pkt.size, pkt.pts);
diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index 1c6d826..6fb5ffe 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -73,6 +73,7 @@ static const AVOption options[] = {
{ "draw_bars", "draw bars on signal loss" , OFFSET(draw_bars),
AV_OPT_TYPE_BOOL,  { .i64 = 1}, 0, 1, DEC },
{ "queue_size","input queue buffer size",   OFFSET(queue_size),   
AV_OPT_TYPE_INT64, { .i64 = (1024 * 1024 * 1024)}, 0, INT64_MAX, DEC },
{ "audio_depth",   "audio bitdepth (16 or 32)", OFFSET(audio_depth),  
AV_OPT_TYPE_INT,   { .i64 = 16}, 16, 32, DEC },
+{ "decklink_copyts", "copy timestamps, do not remove the initial offset", 
OFFSET(copyts), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, DEC },


AV_OPT_TYPE_BOOL


{ NULL },
};

--
1.9.1



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


Re: [FFmpeg-devel] GSoC 2018

2018-01-12 Thread Pedro Arthur
2018-01-12 0:06 GMT-02:00 Michael Niedermayer :

> if pedro is up to date on this stuff, then maybe he wants to mentor this
>
> either way, links to relevant research, tests, literature are welcome
>
> I can mentor this.

One of the first NN based method was [1] which has a very simple network
layout, only 3 convolution layers. More complex methods can be found in
[2], [3], [4].
The important question is where we are going to perfom only inference,
using a pre-trained net or we will also train the net. The first is more
easy to do but we don't exploit the content knowledge we have, the second
is more powerful as it adapts to the content but requires training which
may be  expensive, in this case it would be best to use some library to
perform the training.

There are also method which does not use NN like A+ [5] and ANR.

[1] - https://arxiv.org/abs/1501.00092
[2] - https://arxiv.org/abs/1609.05158
[3] - https://arxiv.org/abs/1603.08155
[4] - https://arxiv.org/abs/1609.04802
[5] -
http://www.vision.ee.ethz.ch/~timofter/publications/Timofte-ACCV-2014.pdf
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/drawtext - implement fix_bounds

2018-01-12 Thread Gyan Doshi


On 1/12/2018 2:01 PM, Kyle Swanson wrote:


Just read through the patch, but actually didn't try it yet. I wonder if we
should also scale the size of the text in cases where it's wider than the
frame?


Worth considering. Note that fontsize may be dynamic e.g. `50+t*20` 
which can lead to jerky output if the text is resized mid-animation. I 
realize this should be the concern of the user, but so should fix_bounds 
in the first place :)



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


Re: [FFmpeg-devel] [PATCH] add dumpwave filter

2018-01-12 Thread Дмитрий Гуменюк
> On 12 Jan 2018, at 13:17, Tobias Rapp  wrote:
> 
> On 12.01.2018 12:16, Дмитрий Гуменюк wrote:
>> Hi
>>> On 11 Jan 2018, at 09:20, Tobias Rapp  wrote:
>>> 
>>> On 10.01.2018 18:18, Kyle Swanson wrote:
 Hi,
 For this to be a part of libavfilter the output needs to be more generic
 than the just the Soundcloud format. If we want this to be generally useful
 it should probably just output an array of floats between 0.0 and 1.0. The
 consumer of this data (JS library, or whatever) can use this in whatever
 way it wants.
>>> 
>>> I agree. If the BWF Peak Envelope output which was suggested in the other 
>>> thread does not match your demands and filter implementation is actually 
>>> necessary I would prefer if the filter would attach the RMS value(s) as 
>>> frame metadata instead of directly dumping to file. Frame metadata can then 
>>> be re-
>> RMS values may be counted for several frames or only for a half of a frame
>>> used by other filters or dumped into file by using the existing "ametadata" 
>>> filter.
>>> 
>>> This would be similar to:
>>> 
>>> ffmpeg -i input-file -f null -filter:a 
>>> "asetnsamples=22050,astats=metadata=on,ametadata=print:file=stats-file.dat" 
>>> /dev/null
>> I like this idea, but won’t asetnsamples affect performance by creating fifo 
>> queue? And it may require some effort to parse long output
> 
> I added asetnsamples to define the audio frame size (interval of values from 
> astats). You can reduce the number of lines printed by ametadata by using the 
> "key=lavfi.astats.foo" option.
I used asetnsamples as well, and I measured performance while transcoding - it 
appears to be slight slower
> 
> 
> Regards,
> Tobias
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org 
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel 
> 


smime.p7s
Description: S/MIME cryptographic signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] add dumpwave filter

2018-01-12 Thread Tobias Rapp

On 12.01.2018 12:16, Дмитрий Гуменюк wrote:

Hi

On 11 Jan 2018, at 09:20, Tobias Rapp  wrote:

On 10.01.2018 18:18, Kyle Swanson wrote:

Hi,
For this to be a part of libavfilter the output needs to be more generic
than the just the Soundcloud format. If we want this to be generally useful
it should probably just output an array of floats between 0.0 and 1.0. The
consumer of this data (JS library, or whatever) can use this in whatever
way it wants.


I agree. If the BWF Peak Envelope output which was suggested in the other 
thread does not match your demands and filter implementation is actually 
necessary I would prefer if the filter would attach the RMS value(s) as frame 
metadata instead of directly dumping to file. Frame metadata can then be re-

RMS values may be counted for several frames or only for a half of a frame

used by other filters or dumped into file by using the existing "ametadata" 
filter.

This would be similar to:

ffmpeg -i input-file -f null -filter:a 
"asetnsamples=22050,astats=metadata=on,ametadata=print:file=stats-file.dat" 
/dev/null

I like this idea, but won’t asetnsamples affect performance by creating fifo 
queue? And it may require some effort to parse long output


I added asetnsamples to define the audio frame size (interval of values 
from astats). You can reduce the number of lines printed by ametadata by 
using the "key=lavfi.astats.foo" option.


Regards,
Tobias

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


Re: [FFmpeg-devel] GSoC 2018

2018-01-12 Thread Thilo Borgmann
Am 12.01.18 um 03:41 schrieb wm4:
> On Fri, 12 Jan 2018 03:06:29 +0100
> Michael Niedermayer  wrote:
> 
>> On Thu, Jan 11, 2018 at 09:17:06PM +0100, Thilo Borgmann wrote:
>>> Am 11.01.18 um 19:45 schrieb Michael Niedermayer:  
 On Thu, Jan 11, 2018 at 02:43:01PM -0200, Pedro Arthur wrote:  
> Hi,
>
> What about a Super Resolution filter? lately there was much research in
> this area, mainly in Single Image Super Resolution.
> I think it would be an interesting experiment, and maybe we could get
> something useful from it.  

 this sounds very interresting, yes  
>>>
>>> +1. If you would like to mentor such a task please feel free to define a 
>>> task on the wiki page.  
>>
>> I would first have to read up on the subject as iam not up to date on
>> this.
>> [...]

I was actually referring to Pedro with that, mentoring this from scratch should
hardly be feasible.

-Thilo

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


Re: [FFmpeg-devel] [PATCH v2] avfilter: add dumpwave filter.

2018-01-12 Thread Dmitry Gumenyuk

> On 12 Jan 2018, at 08:36, Kyle Swanson  wrote:
> 
> Hi,
> 
> Make sure you go back and read our comments. There were several things you
> didn't address in your most recent patch.
Sorry, seems I missed few emails. Sure
> Thanks,
> Kyle
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


smime.p7s
Description: S/MIME cryptographic signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 2/4] avformat/libopenmpt: Update to libopenmpt 0.3 API

2018-01-12 Thread Michael Niedermayer
On Thu, Jan 11, 2018 at 09:11:30AM +0100, Jörn Heusipp wrote:
> libopenmpt 0.3 deprecates openmpt_module_create_from_memory() and
> provides a replacement function openmpt_module_create_from_memory2().
> 
> Detecting libopenmpt 0.3 can be done at build time via the API
> version macros provided by libopenmpt. libopenmpt 0.2 did not provide
> all required macros, however libopenmpt documents the required #define
> shims that can be safely added for libopenmpt 0.2.
> 
> Using openmpt_module_create_from_memory2() instead of
> openmpt_module_create_from_memory() avoids the deprecation warning
> when building ffmpeg with libopenmpt 0.3.
> 
> openmpt_module_create_from_memory2() provides more fine-grained error
> reporting and in particular allows distinguishing out-of-memory from
> input file parsing errors. Return appropriate ffmpeg errors
> accordingly.
> 
> libopenmpt 0.3 is ABI and API compatible with applications built
> against libopenmpt 0.2. Building ffmpeg with libopenmpt 0.2 is still
> supported.
> 
> Signed-off-by: Jörn Heusipp 
> ---
>  libavformat/libopenmpt.c | 25 +
>  1 file changed, 25 insertions(+)

applied

thx

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

You can kill me, but you cannot change the truth.


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


Re: [FFmpeg-devel] [PATCH v3 1/4] avformat/libopenmpt: Fix mixed code and declarations

2018-01-12 Thread Michael Niedermayer
On Thu, Jan 11, 2018 at 09:11:29AM +0100, Jörn Heusipp wrote:
> Signed-off-by: Jörn Heusipp 
> ---
>  libavformat/libopenmpt.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)

applied

thx

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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


Re: [FFmpeg-devel] [PATCH] avdevice/gdigrab: Fix screen size and mouse position calculations on hi-DPI screens

2018-01-12 Thread Michael Niedermayer
On Tue, Nov 28, 2017 at 09:59:02AM +0100, Harald Gaechter wrote:
> Signed-off-by: Harald Gaechter 
> ---
>  libavdevice/gdigrab.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)

will apply

thx

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

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


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


Re: [FFmpeg-devel] [PATCH 3/3] http: fix memory leak in parse_cookie.

2018-01-12 Thread Michael Niedermayer
On Thu, Jan 11, 2018 at 03:15:41PM -0800, Richard Shaffer wrote:
> On Thu, Jan 11, 2018 at 2:49 PM, Moritz Barsnick  wrote:
> 
> > On Thu, Jan 11, 2018 at 14:28:52 -0800, rshaf...@tunein.com wrote:
> >
> > > [PATCH 3/3] http: fix memory leak in parse_cookie.g
> >
> > > This is my first time contributing.
> >
> > Where are the other two of the three ("3/3") patches then? (Not
> > important, but it's confusing on the mailing list.)
> >
> 
> I apologize for the 3/3 in the subject. Patches 1 and 2 deal with something
> else, and I'll submit those for review later.
> 
> 
> > > The problem and the solution seem pretty straightforward, but if I'm
> > missing something, please do point me in the right direction.
> >
> > I believe the way you submitted this, this text would be part of your
> > commit message. If you desire to type it into the email, please put it
> > below the three dashes:
> 
> 
> Good to know. If someone is willing to review the substance of the patch,
> hopefully they'll remove my introduction before committing.

will apply with the commit messages fixed

thx

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] [PATCH 1/2] examples/vaapi_encode: Remove redundancy check when free context.

2018-01-12 Thread Michael Niedermayer
On Thu, Jan 11, 2018 at 03:07:18PM +0800, Jun Zhao wrote:
> 

>  vaapi_encode.c |3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 6002024418a485e89bb71fac812f5c540a434cf5  
> 0001-examples-vaapi_encode-Remove-redundancy-check-when-f.patch
> From ef424745ce8d425859e9ca16dd9aca72297ed90a Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Thu, 11 Jan 2018 13:21:58 +0800
> Subject: [PATCH 1/2] examples/vaapi_encode: Remove redundancy check when free
>  context.
> 
> avcodec_free_context have handle NULL pointer case, so caller doesn't
> need to check the NULL before call this function.
> 
> Signe-off-by: Jun Zhao 
> ---
>  doc/examples/vaapi_encode.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/doc/examples/vaapi_encode.c b/doc/examples/vaapi_encode.c
> index f66a4a7c48..6425b1c98c 100644
> --- a/doc/examples/vaapi_encode.c
> +++ b/doc/examples/vaapi_encode.c
> @@ -217,8 +217,7 @@ close:
>  fclose(fout);
>  av_frame_free(&sw_frame);
>  av_frame_free(&hw_frame);
> -if (avctx)
> -avcodec_free_context(&avctx);
> +avcodec_free_context(&avctx);
>  av_buffer_unref(&hw_device_ctx);

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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



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


Re: [FFmpeg-devel] [PATCH] add dumpwave filter

2018-01-12 Thread Дмитрий Гуменюк
Hi
> On 11 Jan 2018, at 09:20, Tobias Rapp  wrote:
> 
> On 10.01.2018 18:18, Kyle Swanson wrote:
>> Hi,
>> For this to be a part of libavfilter the output needs to be more generic
>> than the just the Soundcloud format. If we want this to be generally useful
>> it should probably just output an array of floats between 0.0 and 1.0. The
>> consumer of this data (JS library, or whatever) can use this in whatever
>> way it wants.
> 
> I agree. If the BWF Peak Envelope output which was suggested in the other 
> thread does not match your demands and filter implementation is actually 
> necessary I would prefer if the filter would attach the RMS value(s) as frame 
> metadata instead of directly dumping to file. Frame metadata can then be re-
RMS values may be counted for several frames or only for a half of a frame 
> used by other filters or dumped into file by using the existing "ametadata" 
> filter.
> 
> This would be similar to:
> 
> ffmpeg -i input-file -f null -filter:a 
> "asetnsamples=22050,astats=metadata=on,ametadata=print:file=stats-file.dat" 
> /dev/null
I like this idea, but won’t asetnsamples affect performance by creating fifo 
queue? And it may require some effort to parse long output
> 
> 
> BTW: The "astats" filter already provides some RMS values.
> 
>> If you send another patch, just reply to this thread because
>> that makes it easier to follow (sending a patch as an attachment is OK).
>> Here are some critiques:
>> [...]
> 
> Also when sending patches adding an increased version number helps sorting 
> out which is the latest one (git format-patch -v2 ...).
> 
> Regards,
> Tobias
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



smime.p7s
Description: S/MIME cryptographic signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] Add libcodec2 en/decoder

2018-01-12 Thread Tomas Härdin

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


Re: [FFmpeg-devel] avcodec/utvideoenc : add SIMD (SSSE3) for sub_left_pred

2018-01-12 Thread Martin Vignali
>
> this changes the output:
> make -j12 && ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -an -vcodec
> utvideo -t 1 -pix_fmt yuv420p -pred left  -t 1 test2.avi
>
> -rw-r- 1 michael michael 3744402 Jan 12 04:20 test2.avi
> -rw-r- 1 michael michael 3753358 Jan 12 04:19 test.avi
>
>
> Hello,

Thanks for testing.
Is it possible to have the file ?

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


Re: [FFmpeg-devel] [PATCH] avfilter/drawtext - implement fix_bounds

2018-01-12 Thread Kyle Swanson
Hi,

On Thu, Jan 11, 2018 at 5:42 AM, Gyan Doshi  wrote:

> The no-op commit e496c45 from Libav introduced an option which allowed the
> user to relocate text to fit within the frame if it was going out of bounds.
>
> For some reason, when the merge commit b479e01 was applied, the option was
> added but the code fragment which implemented it, was not. So the option
> was dead on arrival, and has remained impotent (since Feb 2012).
>
> Attached patch implements option. Text styling elements like shadow or box
> are also kept within bounds. Default value changed to false so that filter
> outcome doesn't change in existing scripts.
>
> Regards,
> Gyan
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
Just read through the patch, but actually didn't try it yet. I wonder if we
should also scale the size of the text in cases where it's wider than the
frame?

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