[FFmpeg-devel] [PATCH] PPC64: Add IBM POWER8 SIMD Implementation

2016-06-14 Thread Dan Parrot
This is the first commit addressing Trac ticket #5570. Functions defined in
libswscale/input.c have corresponding definitions in libswscale/ppc/input_vsx.h
The corresponding function names in the latter contain the suffix "_vsx".
---
 libswscale/input.c |  44 +--
 libswscale/ppc/input_vsx.h | 831 +
 2 files changed, 853 insertions(+), 22 deletions(-)
 create mode 100644 libswscale/ppc/input_vsx.h

diff --git a/libswscale/input.c b/libswscale/input.c
index 14ab5ab..de4347e 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -40,6 +40,13 @@
 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || 
origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || 
origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
 
+#ifdef HAVE_VSX
+#include "ppc/input_vsx.h"
+#define RENAME_SIMD(fname) fname ## _vsx
+#elif
+#define RENAME_SIMD(fname) fname
+#endif
+
 static av_always_inline void
 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
 enum AVPixelFormat origin, int32_t *rgb2yuv)
@@ -99,7 +106,7 @@ static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, 
const uint8_t *_src,
 { \
 const uint16_t *src = (const uint16_t *) _src; \
 uint16_t *dst = (uint16_t *) _dst; \
-rgb64ToY_c_template(dst, src, width, origin, rgb2yuv); \
+RENAME_SIMD(rgb64ToY_c_template)(dst, src, width, origin, rgb2yuv); \
 } \
  \
 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
@@ -109,7 +116,7 @@ static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t 
*_dstU, uint8_t *_dstV, \
 const uint16_t *src1 = (const uint16_t *) _src1, \
*src2 = (const uint16_t *) _src2; \
 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
-rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
+RENAME_SIMD(rgb64ToUV_c_template)(dstU, dstV, src1, src2, width, origin, 
rgb2yuv); \
 } \
  \
 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t 
*_dstV, \
@@ -119,7 +126,7 @@ static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t 
*_dstU, uint8_t *_dstV
 const uint16_t *src1 = (const uint16_t *) _src1, \
*src2 = (const uint16_t *) _src2; \
 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
-rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); 
\
+RENAME_SIMD(rgb64ToUV_half_c_template)(dstU, dstV, src1, src2, width, 
origin, rgb2yuv); \
 }
 
 rgb64funcs(rgb, LE, AV_PIX_FMT_RGBA64LE)
@@ -203,7 +210,7 @@ static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst,  
\
 {   \
 const uint16_t *src = (const uint16_t *)_src;   \
 uint16_t *dst   = (uint16_t *)_dst; \
-rgb48ToY_c_template(dst, src, width, origin, rgb2yuv);  \
+RENAME_SIMD(rgb48ToY_c_template)(dst, src, width, origin, rgb2yuv);
  \
 }   \
 \
 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU,\
@@ -218,7 +225,7 @@ static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t 
*_dstU,\
*src2 = (const uint16_t *)_src2; \
 uint16_t *dstU = (uint16_t *)_dstU, \
  *dstV = (uint16_t *)_dstV; \
-rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv);  
  \
+RENAME_SIMD(rgb48ToUV_c_template)(dstU, dstV, src1, src2, width, origin, 
rgb2yuv);\
 }   \
 \
 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU,   \
@@ -233,7 +240,7 @@ static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t 
*_dstU,   \
*src2 = (const uint16_t *)_src2; \
 uint16_t *dstU = (uint16_t *)_dstU, \
  *dstV = (uint16_t *)_dstV; \
-rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); 
  \
+RENAME_SIMD(rgb48ToUV_half_c_template)(dstU, dstV, src1, src2, width, 
origin, rgb2yuv);   \
 }
 
 rgb48funcs(rgb, LE, AV_PIX_FMT_RGB48LE)
@@ -273,7 +280,6 @@ static av_always_inline void rgb16_32ToY_c_template(int16_t 
*dst,
 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
 }
 }
-
 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
  int16_t *dstV,

Re: [FFmpeg-devel] [PATCH] PPC64: IBM POWER8 SIMD Implementation

2016-06-14 Thread Dan Parrot
On Tue, 2016-06-14 at 18:56 -0500, Dan Parrot wrote:
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Please disregard this attempted patch. Made wrong choice of using email
client rather than git send-email.

Apologies.

Dan.


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


Re: [FFmpeg-devel] [PATCH] libopusenc: Add channel mapping family argument

2016-06-14 Thread Michael Graczyk
Michael,

Thanks for the input. I have refactored the patch into two patches. The
first refactors to make the second patch simpler. I have attached both new
patches.

As for the approach, I can see why this may not be an ideal approach. I
based this patch on a discussion I had on #ffmpeg-devel a month or so ago.
It seemed that the consensus then was that I should add a mapping_family
command line parameter as I have done in this patch. However, it was not
absolutely clear that this would be the best approach.

Do you have an alternative in mind? What do you mean by "passed through API
like side data"?

Thanks,
Michael
From 52c16ba12344f1c461a7e0b8484361020039e419 Mon Sep 17 00:00:00 2001
From: Michael Graczyk 
Date: Tue, 14 Jun 2016 18:30:36 -0700
Subject: [PATCH 1/2] libopusenc: Refactor to simplify forthcoming
 mapping_family parameter

---
 libavcodec/libopusenc.c | 79 +++--
 1 file changed, 43 insertions(+), 36 deletions(-)

diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 3f3e80d..c9b96ce 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -79,6 +79,7 @@ static const uint8_t libavcodec_libopus_channel_map[8][8] = {
 
 static void libopus_write_header(AVCodecContext *avctx, int stream_count,
  int coupled_stream_count,
+ int mapping_family,
  const uint8_t *channel_mapping)
 {
 uint8_t *p   = avctx->extradata;
@@ -93,7 +94,7 @@ static void libopus_write_header(AVCodecContext *avctx, int 
stream_count,
 
 /* Channel mapping */
 if (channels > 2) {
-bytestream_put_byte(, channels <= 8 ? 1 : 255);
+bytestream_put_byte(, mapping_family);
 bytestream_put_byte(, stream_count);
 bytestream_put_byte(, coupled_stream_count);
 bytestream_put_buffer(, channel_mapping, channels);
@@ -159,37 +160,11 @@ static int libopus_configure_encoder(AVCodecContext 
*avctx, OpusMSEncoder *enc,
 static av_cold int libopus_encode_init(AVCodecContext *avctx)
 {
 LibopusEncContext *opus = avctx->priv_data;
-const uint8_t *channel_mapping;
 OpusMSEncoder *enc;
+uint8_t libopus_channel_mapping[255];
 int ret = OPUS_OK;
 int coupled_stream_count, header_size, frame_size;
 
-coupled_stream_count = opus_coupled_streams[avctx->channels - 1];
-opus->stream_count   = avctx->channels - coupled_stream_count;
-channel_mapping  = libavcodec_libopus_channel_map[avctx->channels - 1];
-
-/* FIXME: Opus can handle up to 255 channels. However, the mapping for
- * anything greater than 8 is undefined. */
-if (avctx->channels > 8) {
-av_log(avctx, AV_LOG_ERROR,
-   "Channel layout undefined for %d channels.\n", avctx->channels);
-return AVERROR_PATCHWELCOME;
-}
-if (!avctx->bit_rate) {
-/* Sane default copied from opusenc */
-avctx->bit_rate = 64000 * opus->stream_count +
-  32000 * coupled_stream_count;
-av_log(avctx, AV_LOG_WARNING,
-   "No bit rate set. Defaulting to %"PRId64" bps.\n", 
(int64_t)avctx->bit_rate);
-}
-
-if (avctx->bit_rate < 500 || avctx->bit_rate > 256000 * avctx->channels) {
-av_log(avctx, AV_LOG_ERROR, "The bit rate %"PRId64" bps is 
unsupported. "
-   "Please choose a value between 500 and %d.\n", 
(int64_t)avctx->bit_rate,
-   256000 * avctx->channels);
-return AVERROR(EINVAL);
-}
-
 frame_size = opus->opts.frame_duration * 48000 / 1000;
 switch (frame_size) {
 case 120:
@@ -251,17 +226,49 @@ static av_cold int libopus_encode_init(AVCodecContext 
*avctx)
 }
 }
 
-enc = opus_multistream_encoder_create(avctx->sample_rate, avctx->channels,
-  opus->stream_count,
-  coupled_stream_count,
-  channel_mapping,
-  opus->opts.application, );
+/* FIXME: Opus can handle up to 255 channels. However, the mapping for
+ * anything greater than 8 is undefined. */
+if (avctx->channels > 8) {
+av_log(avctx, AV_LOG_ERROR,
+   "Channel layout undefined for %d channels.\n", avctx->channels);
+return AVERROR_PATCHWELCOME;
+}
+
+coupled_stream_count = opus_coupled_streams[avctx->channels - 1];
+opus->stream_count   = avctx->channels - coupled_stream_count;
+
+memcpy(libopus_channel_mapping,
+   opus_vorbis_channel_map[avctx->channels - 1],
+   avctx->channels * sizeof(*libopus_channel_mapping));
+
+enc = opus_multistream_encoder_create(
+avctx->sample_rate, avctx->channels, opus->stream_count,
+coupled_stream_count,
+libavcodec_libopus_channel_map[avctx->channels - 1],
+opus->opts.application, );
+
 if (ret != 

Re: [FFmpeg-devel] [PATCH v5] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread KongQun Yang
-- KongQun Yang (KQ)

On Tue, Jun 14, 2016 at 4:34 PM, Hendrik Leppkes 
wrote:

> On Wed, Jun 15, 2016 at 12:05 AM, Kongqun Yang 
> wrote:
> > Implemented according to the draft specification
> > "VP Codec ISO Media File Format Binding":
> >
> http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding
> >
> > '-strict -2' is required to use this feature.
> >
>
> Not sure I really like the vpc name, when I read vpc I don't think of
> vp9, and the correlation to avc/hevc is also not really there, as
> those codecs are actually called that. AVC and HEVC, the C isn't added
> randomly.
> If anything, it should have been vp9.c then, but oh well.
>
> But anyway, if Ronald is ok with the name I won't complain.
>
> > ---
> >  libavformat/Makefile |   2 +-
> >  libavformat/isom.c   |   3 +
> >  libavformat/movenc.c |  26 +
> >  libavformat/vpc.c| 159
> +++
> >  libavformat/vpc.h|  44 ++
> >  5 files changed, 233 insertions(+), 1 deletion(-)
> >  create mode 100644 libavformat/vpc.c
> >  create mode 100644 libavformat/vpc.h
> >
> > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > index 6684ead..be8c261 100644
> > --- a/libavformat/Makefile
> > +++ b/libavformat/Makefile
> > @@ -276,7 +276,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
> >  OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
> >  OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
> >  OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o
> replaygain.o
> > -OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o \
> > +OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpc.o
> \
> >  movenchint.o mov_chan.o
> rtp.o \
> >  movenccenc.o rawutils.o
> >  OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
> > diff --git a/libavformat/isom.c b/libavformat/isom.c
> > index b1757e2..9a65268 100644
> > --- a/libavformat/isom.c
> > +++ b/libavformat/isom.c
> > @@ -59,6 +59,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
> >  { AV_CODEC_ID_AC3 , 0xA5 },
> >  { AV_CODEC_ID_EAC3, 0xA6 },
> >  { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
> > +{ AV_CODEC_ID_VP9 , 0xC0 }, /* non standard, update when
> there is a standard value */
> >  { AV_CODEC_ID_TSCC2   , 0xD0 }, /* non standard, camtasia uses
> it */
> >  { AV_CODEC_ID_VORBIS  , 0xDD }, /* non standard, gpac uses it */
> >  { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see
> unsupported-embedded-subs-2.mp4 */
> > @@ -179,6 +180,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
> >  { AV_CODEC_ID_H264, MKTAG('a', 'i', 'v', 'x') }, /* XAVC 4:2:2
> 10bit */
> >  { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision
> */
> >
> > +{ AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
> > +
> >  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
> >  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple
> MPEG-1 Camcorder */
> >  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index 2f00091..e4c51e8 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -49,6 +49,7 @@
> >  #include "hevc.h"
> >  #include "rtpenc.h"
> >  #include "mov_chan.h"
> > +#include "vpc.h"
> >
> >  static const AVOption options[] = {
> >  { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags),
> AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
> AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
> > @@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb,
> MOVTrack *track)
> >  return update_size(pb, pos);
> >  }
> >
> > +static int mov_write_vpcc_tag(AVIOContext *pb, MOVTrack *track)
> > +{
> > +int64_t pos = avio_tell(pb);
> > +
> > +avio_wb32(pb, 0);
> > +ffio_wfourcc(pb, "vpcC");
> > +avio_wb32(pb, 0); /* version & flags */
> > +ff_isom_write_vpcc(pb, track->par);
> > +return update_size(pb, pos);
> > +}
> > +
> >  static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
> >  {
> >  int64_t pos = avio_tell(pb);
> > @@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s,
> MOVTrack *track)
> >
> >  if  (track->par->codec_id == AV_CODEC_ID_H264)  tag =
> MKTAG('a','v','c','1');
> >  else if (track->par->codec_id == AV_CODEC_ID_HEVC)  tag =
> MKTAG('h','e','v','1');
> > +else if (track->par->codec_id == AV_CODEC_ID_VP9)   tag =
> MKTAG('v','p','0','9');
> >  else if (track->par->codec_id == AV_CODEC_ID_AC3)   tag =
> MKTAG('a','c','-','3');
> >  else if (track->par->codec_id == AV_CODEC_ID_EAC3)  tag =
> MKTAG('e','c','-','3');
> >  else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag =
> 

Re: [FFmpeg-devel] [PATCH v5] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread KongQun Yang
-- KongQun Yang (KQ)

On Tue, Jun 14, 2016 at 4:20 PM, Ronald S. Bultje 
wrote:

> Hi,
>
> On Tue, Jun 14, 2016 at 6:05 PM, Kongqun Yang 
> wrote:
>
>> +default:
>> +av_log(NULL, AV_LOG_ERROR, "Unsupported color space (%d)\n",
>> +   color_space);
>> +return -1;
>>
> [..]
>
>> +default:
>> +av_log(NULL, AV_LOG_ERROR, "Unsupported pixel format (%d)\n",
>> +   pixel_format);
>> +return -1;
>>
> [..]
>
>> +if (desc == NULL) {
>> +av_log(NULL, AV_LOG_ERROR, "Unsupported pixel format (%d)\n",
>> +   pixel_format);
>> +return -1;
>>
>
> You're still logging without a context (first argument), can you please
> provide one so people know which muxer is complaining about these error
> messages?
>

Are you ok with using "AVIOContext" as the context?

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


Re: [FFmpeg-devel] [PATCH v5] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread Ronald S. Bultje
Hi,

On Tue, Jun 14, 2016 at 7:34 PM, Hendrik Leppkes 
wrote:

> On Wed, Jun 15, 2016 at 12:05 AM, Kongqun Yang 
> wrote:
> > Implemented according to the draft specification
> > "VP Codec ISO Media File Format Binding":
> >
> http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding
> >
> > '-strict -2' is required to use this feature.
> >
>
> Not sure I really like the vpc name, when I read vpc I don't think of
> vp9, and the correlation to avc/hevc is also not really there, as
> those codecs are actually called that. AVC and HEVC, the C isn't added
> randomly.
> If anything, it should have been vp9.c then, but oh well.
>
> But anyway, if Ronald is ok with the name I won't complain.
>

I think they intend to use it for vp10 also.


> > +static int get_vpx_transfer_function(
> > +enum AVColorTransferCharacteristic transfer)
> > +{
> > +return !!(transfer == AVCOL_TRC_SMPTEST2084);
>
> This looks like an odd way to write it, if its ever extended to make
> use of more values, you'll have to change it entirely.
> But really just a style nit.


I think I agree, the == already makes the result 1/0, so the !! doesn't do
anything.

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


Re: [FFmpeg-devel] [PATCH] libopusenc: Add channel mapping family argument

2016-06-14 Thread Michael Niedermayer
On Fri, Jun 10, 2016 at 10:39:23PM -0700, Michael Graczyk wrote:
> The libopus encoder has a parameter called "channel mapping family" which
> is used to specify inter-channel relationships for the purpose of encoding.
> I have added a new command line argument which makes it possible to forward
> the mapping family parameter along to libopus.
> 
> With this parameter, it is possible to choose between encoding multichannel
> audio streams as surround sound (with interchannel masking and channel
> coupling) versus independent channels (no interchannel masking nor channel
> coupling).
> 
> Example usage:
> 
> $ wget https://samples.ffmpeg.org/A-codecs/wavpcm/8_Channel_ID.wav -O in.wav
> 
> # Use the old behavior. Header contains layout, but no masking
> $ ./ffmpeg -y -i in.wav -c:a opus -mapping_family -1 out.ogg
> 
> # Use libopus surround mode. Masking + automatic channel coupling
> $ ./ffmpeg -y -i in.wav -c:a opus -mapping_family 1 out.ogg
> 
> # Use libopus with independent channels. No header info, no masking, no
> coupling
> $ ./ffmpeg -y -i in.wav -c:a opus -mapping_family 255 out.ogg
> 
> This patch also makes it possible to encode up to 254 channels with opus
> using channel mapping family 255.
> 
> $ head -c 1728000 /dev/urandom > noise.raw
> $ ./ffmpeg -y -f s16le -ar 48000 -ac 18 -i noise.raw -c:a opus
> -mapping_family 255 out.opus
> 
> 
> Questions:
> 
> 1. I had to remove .channel_layouts form ff_libopus_encoder to allow the
> encoder to accept streams with more than 8 channels. Is that the right way
> to extend the encoder? Based on a discussion on #ffmpeg it seemed like
> removing the .channel_layouts field would be the only way to allow more
> than 16 channels.

> 2. Am I using AVFrame.data correctly? I recall reading somewhere that
> channels after the eighth would be stored in extended_data, but from the
> documentation it seems like that is only the case for planar data.

extended_data is for more than AV_NUM_DATA_POINTERS planar channels,
yes

it seems this patch moves some code around, can that be split into
a seperate patch so its more clearly vissible what is changed.

Also iam not sure people will like the aprouch taken by this patch
or prefer the mapping_family to be passed through API like side data
and be preserved from input to output

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


[FFmpeg-devel] [PATCH] PPC64: IBM POWER8 SIMD Implementation

2016-06-14 Thread Dan Parrot

From e38eb7af05be27d8f36058373557d86e5a481db8 Mon Sep 17 00:00:00 2001
From: Dan Parrot 
Date: Tue, 14 Jun 2016 23:19:21 +
Subject: [PATCH] PPC64: IBM POWER8 SIMD Implementation

This is the first commit addressing Trac ticket #5570. Functions defined in
libswscale/input.c have corresponding definitions in libswscale/ppc/input_vsx.h
The corresponding function names in the latter contain the suffix "_vsx".
---
 libswscale/input.c |  38 ++-
 libswscale/ppc/input_vsx.h | 831 +
 2 files changed, 853 insertions(+), 16 deletions(-)
 create mode 100644 libswscale/ppc/input_vsx.h

diff --git a/libswscale/input.c b/libswscale/input.c
index eed0f49..de4347e 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -40,6 +40,13 @@
 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
 
+#ifdef HAVE_VSX
+#include "ppc/input_vsx.h"
+#define RENAME_SIMD(fname) fname ## _vsx
+#elif
+#define RENAME_SIMD(fname) fname
+#endif
+
 static av_always_inline void
 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
 enum AVPixelFormat origin, int32_t *rgb2yuv)
@@ -99,7 +106,7 @@ static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src,
 { \
 const uint16_t *src = (const uint16_t *) _src; \
 uint16_t *dst = (uint16_t *) _dst; \
-rgb64ToY_c_template(dst, src, width, origin, rgb2yuv); \
+RENAME_SIMD(rgb64ToY_c_template)(dst, src, width, origin, rgb2yuv); \
 } \
  \
 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
@@ -109,7 +116,7 @@ static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
 const uint16_t *src1 = (const uint16_t *) _src1, \
*src2 = (const uint16_t *) _src2; \
 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
-rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
+RENAME_SIMD(rgb64ToUV_c_template)(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
 } \
  \
 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
@@ -119,7 +126,7 @@ static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV
 const uint16_t *src1 = (const uint16_t *) _src1, \
*src2 = (const uint16_t *) _src2; \
 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
-rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
+RENAME_SIMD(rgb64ToUV_half_c_template)(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
 }
 
 rgb64funcs(rgb, LE, AV_PIX_FMT_RGBA64LE)
@@ -203,7 +210,7 @@ static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst,  \
 {   \
 const uint16_t *src = (const uint16_t *)_src;   \
 uint16_t *dst   = (uint16_t *)_dst; \
-rgb48ToY_c_template(dst, src, width, origin, rgb2yuv);  \
+RENAME_SIMD(rgb48ToY_c_template)(dst, src, width, origin, rgb2yuv);  \
 }   \
 \
 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU,\
@@ -218,7 +225,7 @@ static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU,\
*src2 = (const uint16_t *)_src2; \
 uint16_t *dstU = (uint16_t *)_dstU, \
  *dstV = (uint16_t *)_dstV; \
-rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv);\
+RENAME_SIMD(rgb48ToUV_c_template)(dstU, dstV, src1, src2, width, origin, rgb2yuv);\
 }   \
 \
 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU,   \
@@ -233,7 +240,7 @@ static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU,   \
*src2 = (const uint16_t *)_src2; \
 uint16_t *dstU = (uint16_t *)_dstU, \
  *dstV = (uint16_t *)_dstV; \
-rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv);   \
+RENAME_SIMD(rgb48ToUV_half_c_template)(dstU, dstV, src1, src2, width, origin, rgb2yuv);   \
 }
 
 rgb48funcs(rgb, LE, AV_PIX_FMT_RGB48LE)
@@ -273,7 +280,6 @@ static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
 dst[i] = (ry * r + gy * 

Re: [FFmpeg-devel] [PATCH v5] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread Hendrik Leppkes
On Wed, Jun 15, 2016 at 12:05 AM, Kongqun Yang  wrote:
> Implemented according to the draft specification
> "VP Codec ISO Media File Format Binding":
> http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding
>
> '-strict -2' is required to use this feature.
>

Not sure I really like the vpc name, when I read vpc I don't think of
vp9, and the correlation to avc/hevc is also not really there, as
those codecs are actually called that. AVC and HEVC, the C isn't added
randomly.
If anything, it should have been vp9.c then, but oh well.

But anyway, if Ronald is ok with the name I won't complain.

> ---
>  libavformat/Makefile |   2 +-
>  libavformat/isom.c   |   3 +
>  libavformat/movenc.c |  26 +
>  libavformat/vpc.c| 159 
> +++
>  libavformat/vpc.h|  44 ++
>  5 files changed, 233 insertions(+), 1 deletion(-)
>  create mode 100644 libavformat/vpc.c
>  create mode 100644 libavformat/vpc.h
>
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 6684ead..be8c261 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -276,7 +276,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
>  OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
>  OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
>  OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o
> -OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o \
> +OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpc.o \
>  movenchint.o mov_chan.o rtp.o \
>  movenccenc.o rawutils.o
>  OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index b1757e2..9a65268 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -59,6 +59,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
>  { AV_CODEC_ID_AC3 , 0xA5 },
>  { AV_CODEC_ID_EAC3, 0xA6 },
>  { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
> +{ AV_CODEC_ID_VP9 , 0xC0 }, /* non standard, update when there 
> is a standard value */
>  { AV_CODEC_ID_TSCC2   , 0xD0 }, /* non standard, camtasia uses it */
>  { AV_CODEC_ID_VORBIS  , 0xDD }, /* non standard, gpac uses it */
>  { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see 
> unsupported-embedded-subs-2.mp4 */
> @@ -179,6 +180,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
>  { AV_CODEC_ID_H264, MKTAG('a', 'i', 'v', 'x') }, /* XAVC 4:2:2 10bit */
>  { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
>
> +{ AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
> +
>  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
>  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 
> Camcorder */
>  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 2f00091..e4c51e8 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -49,6 +49,7 @@
>  #include "hevc.h"
>  #include "rtpenc.h"
>  #include "mov_chan.h"
> +#include "vpc.h"
>
>  static const AVOption options[] = {
>  { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), 
> AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
> "movflags" },
> @@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb, 
> MOVTrack *track)
>  return update_size(pb, pos);
>  }
>
> +static int mov_write_vpcc_tag(AVIOContext *pb, MOVTrack *track)
> +{
> +int64_t pos = avio_tell(pb);
> +
> +avio_wb32(pb, 0);
> +ffio_wfourcc(pb, "vpcC");
> +avio_wb32(pb, 0); /* version & flags */
> +ff_isom_write_vpcc(pb, track->par);
> +return update_size(pb, pos);
> +}
> +
>  static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
>  {
>  int64_t pos = avio_tell(pb);
> @@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, 
> MOVTrack *track)
>
>  if  (track->par->codec_id == AV_CODEC_ID_H264)  tag = 
> MKTAG('a','v','c','1');
>  else if (track->par->codec_id == AV_CODEC_ID_HEVC)  tag = 
> MKTAG('h','e','v','1');
> +else if (track->par->codec_id == AV_CODEC_ID_VP9)   tag = 
> MKTAG('v','p','0','9');
>  else if (track->par->codec_id == AV_CODEC_ID_AC3)   tag = 
> MKTAG('a','c','-','3');
>  else if (track->par->codec_id == AV_CODEC_ID_EAC3)  tag = 
> MKTAG('e','c','-','3');
>  else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = 
> MKTAG('d','r','a','c');
> @@ -1758,6 +1771,8 @@ static int mov_write_video_tag(AVIOContext *pb, 
> MOVMuxContext *mov, MOVTrack *tr
>  mov_write_avcc_tag(pb, track);
>  if (track->mode == MODE_IPOD)
>  mov_write_uuid_tag_ipod(pb);
> +} else if (track->par->codec_id 

Re: [FFmpeg-devel] [PATCH v5] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread Ronald S. Bultje
Hi,

On Tue, Jun 14, 2016 at 6:05 PM, Kongqun Yang  wrote:

> +default:
> +av_log(NULL, AV_LOG_ERROR, "Unsupported color space (%d)\n",
> +   color_space);
> +return -1;
>
[..]

> +default:
> +av_log(NULL, AV_LOG_ERROR, "Unsupported pixel format (%d)\n",
> +   pixel_format);
> +return -1;
>
[..]

> +if (desc == NULL) {
> +av_log(NULL, AV_LOG_ERROR, "Unsupported pixel format (%d)\n",
> +   pixel_format);
> +return -1;
>

You're still logging without a context (first argument), can you please
provide one so people know which muxer is complaining about these error
messages?

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


Re: [FFmpeg-devel] Where and how to add a custom hardware decoder in libavcodec ?

2016-06-14 Thread Sunny Shukla
Hi can anyone please help !
On Jun 9, 2016 3:37 PM, "Sunny Shukla"  wrote:

> Hi,
>
> I am new to ffmpeg, am working on a custom* board* which has its own
> hardware decoder.
>
> I have a linux application for hardware decoder which take a h264 file as
> input and provides a yuv file as output. It working fine, now we are
> extending this support to *gstreamer* and *ffmpeg* libraries. I am
> familiar with gstreamer but new to ffmpeg.
>
> I just need some quick suggestions on where to add a new decoder and an
> example (in ffmpeg source) on how to do that !
> And one more thing is how to upstream this changes ?
>
> Please guyz help me.
>
> Regards,
> Sunny.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] Add support for vp9 in iso-bmff

2016-06-14 Thread KongQun Yang
Thanks for the review.  Please see patchset v4 for the new change. (Please
ignore patchset v3 which is uploaded incorrectly)

-- KongQun Yang (KQ)

On Tue, Jun 14, 2016 at 1:11 PM, Ronald S. Bultje 
wrote:

> Hi,
>
> On Mon, Jun 13, 2016 at 5:26 PM, Kongqun Yang 
> wrote:
>>
>> @@ -5369,6 +5384,17 @@ static int mov_write_header(AVFormatContext *s)
>>  pix_fmt == AV_PIX_FMT_MONOWHITE ||
>>  pix_fmt == AV_PIX_FMT_MONOBLACK;
>>  }
>> +if (track->mode == MODE_MP4 &&
>> +track->par->codec_id == AV_CODEC_ID_VP9) {
>> +  if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)
>> {
>> +av_log(s, AV_LOG_ERROR,
>> +   "VP9 in MP4 support is experimental, add "
>> +   "'-strict %d' if you want to use it.\n",
>> +   FF_COMPLIANCE_EXPERIMENTAL);
>> +ret = AVERROR_EXPERIMENTAL;
>> +goto error;
>> +  }
>> +}
>>
>
> Please use 4-space indentation (you're using 2).
>

Good catch. Done.

>
>
>> +static int get_vpx_color_space(enum AVColorSpace color_space)
>> +{
>> +switch (color_space) {
>> +case AVCOL_SPC_RGB:
>> +return VPX_COLOR_SPACE_RGB;
>> +case AVCOL_SPC_BT709:
>> +return VPX_COLOR_SPACE_BT709;
>> +case AVCOL_SPC_SMPTE170M:
>> +return VPX_COLOR_SPACE_SMPTE_170;
>> +case AVCOL_SPC_SMPTE240M:
>> +return VPX_COLOR_SPACE_SMPTE_240;
>> +case AVCOL_SPC_BT2020_NCL:
>> +return VPX_COLOR_SPACE_BT2020_NCL;
>> +case AVCOL_SPC_BT2020_CL:
>> +return VPX_COLOR_SPACE_BT2020_CL;
>> +default:
>> +return VPX_COLOR_SPACE_UNSPECIFIED;
>> +}
>> +}
>>
>  [..]
>
>> +static int get_vpx_chroma_subsampling(enum AVPixelFormat pixel_format,
>> +  enum AVChromaLocation
>> chroma_location)
>> +{
>> +switch (pixel_format) {
>> +case AV_PIX_FMT_YUV420P:
>> +case AV_PIX_FMT_YUV420P10LE:
>> +case AV_PIX_FMT_YUV420P10BE:
>> +case AV_PIX_FMT_YUV420P12LE:
>> +case AV_PIX_FMT_YUV420P12BE:
>> +if (chroma_location == AVCHROMA_LOC_LEFT)
>> +return VPX_SUBSAMPLING_420_VERTICAL;
>> +// Otherwise assume collocated.
>> +return VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA;
>> +case AV_PIX_FMT_YUV422P:
>> +case AV_PIX_FMT_YUV422P10LE:
>> +case AV_PIX_FMT_YUV422P10BE:
>> +case AV_PIX_FMT_YUV422P12LE:
>> +case AV_PIX_FMT_YUV422P12BE:
>> +return VPX_SUBSAMPLING_422;
>> +case AV_PIX_FMT_YUV444P:
>> +case AV_PIX_FMT_YUV444P10LE:
>> +case AV_PIX_FMT_YUV444P10BE:
>> +case AV_PIX_FMT_YUV444P12LE:
>> +case AV_PIX_FMT_YUV444P12BE:
>> +return VPX_SUBSAMPLING_444;
>> +default:
>> +av_log(NULL, AV_LOG_ERROR, "Unknown pixel format.");
>> +return -1;
>> +}
>> +}
>>
>
> In ffmpeg, the case and switch should be indented at the same level:
>
> switch (a) {
> case b:
> foo();
> break;
> default:
> bar();
> break;
> }
>

Done.

>
> What happens if the "default:" case is reached? Is the vpcc atom still
> valid? If not, should the muxer error out? Can this even happen at all?
>

I assume you were talking about the color space. The spec allows
unspecified color space (with value 0), so the vpcc atom is valid in this
case. It does happen as the default color space is AVCOL_SPC_UNSPECIFIED.
I have updated the code to make it explicit: vpx color space will be set to
unspecified only if |par->color_space == AVCOL_SPC_UNSPECIFIED|. The code
will error out if an unrecognized color space is encountered.

>
> +static int get_vpx_transfer_function(
>> +enum AVColorTransferCharacteristic transfer)
>> +{
>> +  return (transfer == AVCOL_TRC_SMPTEST2084) ? 1 : 0;
>> +}
>> +
>> +static int get_vpx_video_full_range_flag(enum AVColorRange color_range)
>> +{
>> +return (color_range == AVCOL_RANGE_JPEG) ? 1 : 0;
>> +}
>>
>
> The (..) ? 1 : 0 construct is unnecessary, you can just return .. (or in
> case of non-boolean values, we prefer !!(..)).
>
Done.

>
> I also think it's a bad habit to log generic messages like "unknown pixel
> format" without a logging context, the user will never understand what that
> means.
>
Done (included the pixel format code in the message).

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


[FFmpeg-devel] [PATCH v5] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread Kongqun Yang
Implemented according to the draft specification
"VP Codec ISO Media File Format Binding":
http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding

'-strict -2' is required to use this feature.

Change-Id: Iaa7ddf5524b17e8d79cd1923b26f096d6e91
---
 libavformat/Makefile |   2 +-
 libavformat/isom.c   |   3 +
 libavformat/movenc.c |  26 +
 libavformat/vpc.c| 159 +++
 libavformat/vpc.h|  44 ++
 5 files changed, 233 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/vpc.c
 create mode 100644 libavformat/vpc.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6684ead..be8c261 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -276,7 +276,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
 OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
 OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
 OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o
-OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o \
+OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpc.o \
 movenchint.o mov_chan.o rtp.o \
 movenccenc.o rawutils.o
 OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
diff --git a/libavformat/isom.c b/libavformat/isom.c
index b1757e2..9a65268 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -59,6 +59,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
 { AV_CODEC_ID_AC3 , 0xA5 },
 { AV_CODEC_ID_EAC3, 0xA6 },
 { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
+{ AV_CODEC_ID_VP9 , 0xC0 }, /* non standard, update when there is 
a standard value */
 { AV_CODEC_ID_TSCC2   , 0xD0 }, /* non standard, camtasia uses it */
 { AV_CODEC_ID_VORBIS  , 0xDD }, /* non standard, gpac uses it */
 { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see 
unsupported-embedded-subs-2.mp4 */
@@ -179,6 +180,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_H264, MKTAG('a', 'i', 'v', 'x') }, /* XAVC 4:2:2 10bit */
 { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
 
+{ AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
+
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 
Camcorder */
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2f00091..e4c51e8 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -49,6 +49,7 @@
 #include "hevc.h"
 #include "rtpenc.h"
 #include "mov_chan.h"
+#include "vpc.h"
 
 static const AVOption options[] = {
 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), 
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
@@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack 
*track)
 return update_size(pb, pos);
 }
 
+static int mov_write_vpcc_tag(AVIOContext *pb, MOVTrack *track)
+{
+int64_t pos = avio_tell(pb);
+
+avio_wb32(pb, 0);
+ffio_wfourcc(pb, "vpcC");
+avio_wb32(pb, 0); /* version & flags */
+ff_isom_write_vpcc(pb, track->par);
+return update_size(pb, pos);
+}
+
 static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
 {
 int64_t pos = avio_tell(pb);
@@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack 
*track)
 
 if  (track->par->codec_id == AV_CODEC_ID_H264)  tag = 
MKTAG('a','v','c','1');
 else if (track->par->codec_id == AV_CODEC_ID_HEVC)  tag = 
MKTAG('h','e','v','1');
+else if (track->par->codec_id == AV_CODEC_ID_VP9)   tag = 
MKTAG('v','p','0','9');
 else if (track->par->codec_id == AV_CODEC_ID_AC3)   tag = 
MKTAG('a','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_EAC3)  tag = 
MKTAG('e','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = 
MKTAG('d','r','a','c');
@@ -1758,6 +1771,8 @@ static int mov_write_video_tag(AVIOContext *pb, 
MOVMuxContext *mov, MOVTrack *tr
 mov_write_avcc_tag(pb, track);
 if (track->mode == MODE_IPOD)
 mov_write_uuid_tag_ipod(pb);
+} else if (track->par->codec_id == AV_CODEC_ID_VP9) {
+mov_write_vpcc_tag(pb, track);
 } else if (track->par->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0)
 mov_write_dvc1_tag(pb, track);
 else if (track->par->codec_id == AV_CODEC_ID_VP6F ||
@@ -5369,6 +5384,17 @@ static int mov_write_header(AVFormatContext *s)
 pix_fmt == AV_PIX_FMT_MONOWHITE ||
 pix_fmt == AV_PIX_FMT_MONOBLACK;
 }
+if (track->mode == MODE_MP4 &&
+track->par->codec_id == AV_CODEC_ID_VP9) {
+if 

Re: [FFmpeg-devel] [PATCH v4] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread Ronald S. Bultje
Hi,

On Tue, Jun 14, 2016 at 5:52 PM, Kongqun Yang  wrote:

> +if (profile == FF_PROFILE_UNKNOWN) {
> +  if (vpx_chroma_subsampling == VPX_SUBSAMPLING_420_VERTICAL ||
>

Indent is still 2 spaces in the second block (relative to first).

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


[FFmpeg-devel] [PATCH v4] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread Kongqun Yang
Implemented according to the draft specification
"VP Codec ISO Media File Format Binding":
http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding

'-strict -2' is required to use this feature.

Change-Id: Iaa7ddf5524b17e8d79cd1923b26f096d6e91
---
 libavformat/Makefile |   2 +-
 libavformat/isom.c   |   3 +
 libavformat/movenc.c |  26 +
 libavformat/vpc.c| 159 +++
 libavformat/vpc.h|  44 ++
 5 files changed, 233 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/vpc.c
 create mode 100644 libavformat/vpc.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6684ead..be8c261 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -276,7 +276,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
 OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
 OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
 OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o
-OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o \
+OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpc.o \
 movenchint.o mov_chan.o rtp.o \
 movenccenc.o rawutils.o
 OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
diff --git a/libavformat/isom.c b/libavformat/isom.c
index b1757e2..9a65268 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -59,6 +59,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
 { AV_CODEC_ID_AC3 , 0xA5 },
 { AV_CODEC_ID_EAC3, 0xA6 },
 { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
+{ AV_CODEC_ID_VP9 , 0xC0 }, /* non standard, update when there is 
a standard value */
 { AV_CODEC_ID_TSCC2   , 0xD0 }, /* non standard, camtasia uses it */
 { AV_CODEC_ID_VORBIS  , 0xDD }, /* non standard, gpac uses it */
 { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see 
unsupported-embedded-subs-2.mp4 */
@@ -179,6 +180,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_H264, MKTAG('a', 'i', 'v', 'x') }, /* XAVC 4:2:2 10bit */
 { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
 
+{ AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
+
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 
Camcorder */
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2f00091..e4c51e8 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -49,6 +49,7 @@
 #include "hevc.h"
 #include "rtpenc.h"
 #include "mov_chan.h"
+#include "vpc.h"
 
 static const AVOption options[] = {
 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), 
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
@@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack 
*track)
 return update_size(pb, pos);
 }
 
+static int mov_write_vpcc_tag(AVIOContext *pb, MOVTrack *track)
+{
+int64_t pos = avio_tell(pb);
+
+avio_wb32(pb, 0);
+ffio_wfourcc(pb, "vpcC");
+avio_wb32(pb, 0); /* version & flags */
+ff_isom_write_vpcc(pb, track->par);
+return update_size(pb, pos);
+}
+
 static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
 {
 int64_t pos = avio_tell(pb);
@@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack 
*track)
 
 if  (track->par->codec_id == AV_CODEC_ID_H264)  tag = 
MKTAG('a','v','c','1');
 else if (track->par->codec_id == AV_CODEC_ID_HEVC)  tag = 
MKTAG('h','e','v','1');
+else if (track->par->codec_id == AV_CODEC_ID_VP9)   tag = 
MKTAG('v','p','0','9');
 else if (track->par->codec_id == AV_CODEC_ID_AC3)   tag = 
MKTAG('a','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_EAC3)  tag = 
MKTAG('e','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = 
MKTAG('d','r','a','c');
@@ -1758,6 +1771,8 @@ static int mov_write_video_tag(AVIOContext *pb, 
MOVMuxContext *mov, MOVTrack *tr
 mov_write_avcc_tag(pb, track);
 if (track->mode == MODE_IPOD)
 mov_write_uuid_tag_ipod(pb);
+} else if (track->par->codec_id == AV_CODEC_ID_VP9) {
+mov_write_vpcc_tag(pb, track);
 } else if (track->par->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0)
 mov_write_dvc1_tag(pb, track);
 else if (track->par->codec_id == AV_CODEC_ID_VP6F ||
@@ -5369,6 +5384,17 @@ static int mov_write_header(AVFormatContext *s)
 pix_fmt == AV_PIX_FMT_MONOWHITE ||
 pix_fmt == AV_PIX_FMT_MONOBLACK;
 }
+if (track->mode == MODE_MP4 &&
+track->par->codec_id == AV_CODEC_ID_VP9) {
+if 

Re: [FFmpeg-devel] [PATCH] os_support: use the appropriate stat functions matching the stat type

2016-06-14 Thread Hendrik Leppkes
On Tue, Jun 14, 2016 at 10:06 PM, Michael Niedermayer
 wrote:
> On Tue, Jun 14, 2016 at 05:09:01PM +0200, Hendrik Leppkes wrote:
>> The stat struct is defined to stati64, which requires using the appropriate 
>> wstati/stati functions as well.
>> Fixes a whole bunch of compiler warnings as well as build breakage with the 
>> decklink avdevice.
>> ---
>>  libavformat/os_support.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> please apply, there are multiple reports about this IIRC
>

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


[FFmpeg-devel] [PATCH v3] Add support for vp9 in iso-bmff

2016-06-14 Thread Kongqun Yang
Implemented according to the draft specification
"VP Codec ISO Media File Format Binding":
http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding

Change-Id: Iaa7ddf5524b17e8d79cd1923b26f096d6e91
---
 libavformat/Makefile |   2 +-
 libavformat/isom.c   |   3 +
 libavformat/movenc.c |  26 +
 libavformat/vpc.c| 151 +++
 libavformat/vpc.h|  44 +++
 5 files changed, 225 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/vpc.c
 create mode 100644 libavformat/vpc.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6684ead..be8c261 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -276,7 +276,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
 OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
 OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
 OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o
-OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o \
+OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpc.o \
 movenchint.o mov_chan.o rtp.o \
 movenccenc.o rawutils.o
 OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
diff --git a/libavformat/isom.c b/libavformat/isom.c
index b1757e2..9a65268 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -59,6 +59,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
 { AV_CODEC_ID_AC3 , 0xA5 },
 { AV_CODEC_ID_EAC3, 0xA6 },
 { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
+{ AV_CODEC_ID_VP9 , 0xC0 }, /* non standard, update when there is 
a standard value */
 { AV_CODEC_ID_TSCC2   , 0xD0 }, /* non standard, camtasia uses it */
 { AV_CODEC_ID_VORBIS  , 0xDD }, /* non standard, gpac uses it */
 { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see 
unsupported-embedded-subs-2.mp4 */
@@ -179,6 +180,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_H264, MKTAG('a', 'i', 'v', 'x') }, /* XAVC 4:2:2 10bit */
 { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
 
+{ AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
+
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 
Camcorder */
 { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2f00091..551f0e6 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -49,6 +49,7 @@
 #include "hevc.h"
 #include "rtpenc.h"
 #include "mov_chan.h"
+#include "vpc.h"
 
 static const AVOption options[] = {
 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), 
AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
@@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack 
*track)
 return update_size(pb, pos);
 }
 
+static int mov_write_vpcc_tag(AVIOContext *pb, MOVTrack *track)
+{
+int64_t pos = avio_tell(pb);
+
+avio_wb32(pb, 0);
+ffio_wfourcc(pb, "vpcC");
+avio_wb32(pb, 0); /* version & flags */
+ff_isom_write_vpcc(pb, track->par);
+return update_size(pb, pos);
+}
+
 static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
 {
 int64_t pos = avio_tell(pb);
@@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack 
*track)
 
 if  (track->par->codec_id == AV_CODEC_ID_H264)  tag = 
MKTAG('a','v','c','1');
 else if (track->par->codec_id == AV_CODEC_ID_HEVC)  tag = 
MKTAG('h','e','v','1');
+else if (track->par->codec_id == AV_CODEC_ID_VP9)   tag = 
MKTAG('v','p','0','9');
 else if (track->par->codec_id == AV_CODEC_ID_AC3)   tag = 
MKTAG('a','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_EAC3)  tag = 
MKTAG('e','c','-','3');
 else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = 
MKTAG('d','r','a','c');
@@ -1758,6 +1771,8 @@ static int mov_write_video_tag(AVIOContext *pb, 
MOVMuxContext *mov, MOVTrack *tr
 mov_write_avcc_tag(pb, track);
 if (track->mode == MODE_IPOD)
 mov_write_uuid_tag_ipod(pb);
+} else if (track->par->codec_id == AV_CODEC_ID_VP9) {
+mov_write_vpcc_tag(pb, track);
 } else if (track->par->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0)
 mov_write_dvc1_tag(pb, track);
 else if (track->par->codec_id == AV_CODEC_ID_VP6F ||
@@ -5369,6 +5384,17 @@ static int mov_write_header(AVFormatContext *s)
 pix_fmt == AV_PIX_FMT_MONOWHITE ||
 pix_fmt == AV_PIX_FMT_MONOBLACK;
 }
+if (track->mode == MODE_MP4 &&
+track->par->codec_id == AV_CODEC_ID_VP9) {
+  if (s->strict_std_compliance > 

Re: [FFmpeg-devel] [PATCH] libopusenc: Add channel mapping family argument

2016-06-14 Thread Michael Graczyk
Has anybody had a chance to look at this patch? Any thoughts or ways I can
make it easier to look over?

On Fri, Jun 10, 2016 at 10:39 PM, Michael Graczyk 
wrote:

> The libopus encoder has a parameter called "channel mapping family" which
> is used to specify inter-channel relationships for the purpose of encoding.
> I have added a new command line argument which makes it possible to forward
> the mapping family parameter along to libopus.
>
> With this parameter, it is possible to choose between encoding
> multichannel audio streams as surround sound (with interchannel masking and
> channel coupling) versus independent channels (no interchannel masking nor
> channel coupling).
>
> Example usage:
>
> $ wget https://samples.ffmpeg.org/A-codecs/wavpcm/8_Channel_ID.wav -O
> in.wav
>
> # Use the old behavior. Header contains layout, but no masking
> $ ./ffmpeg -y -i in.wav -c:a opus -mapping_family -1 out.ogg
>
> # Use libopus surround mode. Masking + automatic channel coupling
> $ ./ffmpeg -y -i in.wav -c:a opus -mapping_family 1 out.ogg
>
> # Use libopus with independent channels. No header info, no masking, no
> coupling
> $ ./ffmpeg -y -i in.wav -c:a opus -mapping_family 255 out.ogg
>
> This patch also makes it possible to encode up to 254 channels with opus
> using channel mapping family 255.
>
> $ head -c 1728000 /dev/urandom > noise.raw
> $ ./ffmpeg -y -f s16le -ar 48000 -ac 18 -i noise.raw -c:a opus
> -mapping_family 255 out.opus
>
>
> Questions:
>
> 1. I had to remove .channel_layouts form ff_libopus_encoder to allow the
> encoder to accept streams with more than 8 channels. Is that the right way
> to extend the encoder? Based on a discussion on #ffmpeg it seemed like
> removing the .channel_layouts field would be the only way to allow more
> than 16 channels.
> 2. Am I using AVFrame.data correctly? I recall reading somewhere that
> channels after the eighth would be stored in extended_data, but from the
> documentation it seems like that is only the case for planar data.
>
>
> Thanks for reading,
> Michael Graczyk
>



-- 

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


Re: [FFmpeg-devel] [PATCH v2] Add support for vp9 in iso-bmff

2016-06-14 Thread Ronald S. Bultje
Hi,

On Mon, Jun 13, 2016 at 5:26 PM, Kongqun Yang  wrote:
>
> @@ -5369,6 +5384,17 @@ static int mov_write_header(AVFormatContext *s)
>  pix_fmt == AV_PIX_FMT_MONOWHITE ||
>  pix_fmt == AV_PIX_FMT_MONOBLACK;
>  }
> +if (track->mode == MODE_MP4 &&
> +track->par->codec_id == AV_CODEC_ID_VP9) {
> +  if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
> +av_log(s, AV_LOG_ERROR,
> +   "VP9 in MP4 support is experimental, add "
> +   "'-strict %d' if you want to use it.\n",
> +   FF_COMPLIANCE_EXPERIMENTAL);
> +ret = AVERROR_EXPERIMENTAL;
> +goto error;
> +  }
> +}
>

Please use 4-space indentation (you're using 2).


> +static int get_vpx_color_space(enum AVColorSpace color_space)
> +{
> +switch (color_space) {
> +case AVCOL_SPC_RGB:
> +return VPX_COLOR_SPACE_RGB;
> +case AVCOL_SPC_BT709:
> +return VPX_COLOR_SPACE_BT709;
> +case AVCOL_SPC_SMPTE170M:
> +return VPX_COLOR_SPACE_SMPTE_170;
> +case AVCOL_SPC_SMPTE240M:
> +return VPX_COLOR_SPACE_SMPTE_240;
> +case AVCOL_SPC_BT2020_NCL:
> +return VPX_COLOR_SPACE_BT2020_NCL;
> +case AVCOL_SPC_BT2020_CL:
> +return VPX_COLOR_SPACE_BT2020_CL;
> +default:
> +return VPX_COLOR_SPACE_UNSPECIFIED;
> +}
> +}
>
 [..]

> +static int get_vpx_chroma_subsampling(enum AVPixelFormat pixel_format,
> +  enum AVChromaLocation
> chroma_location)
> +{
> +switch (pixel_format) {
> +case AV_PIX_FMT_YUV420P:
> +case AV_PIX_FMT_YUV420P10LE:
> +case AV_PIX_FMT_YUV420P10BE:
> +case AV_PIX_FMT_YUV420P12LE:
> +case AV_PIX_FMT_YUV420P12BE:
> +if (chroma_location == AVCHROMA_LOC_LEFT)
> +return VPX_SUBSAMPLING_420_VERTICAL;
> +// Otherwise assume collocated.
> +return VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA;
> +case AV_PIX_FMT_YUV422P:
> +case AV_PIX_FMT_YUV422P10LE:
> +case AV_PIX_FMT_YUV422P10BE:
> +case AV_PIX_FMT_YUV422P12LE:
> +case AV_PIX_FMT_YUV422P12BE:
> +return VPX_SUBSAMPLING_422;
> +case AV_PIX_FMT_YUV444P:
> +case AV_PIX_FMT_YUV444P10LE:
> +case AV_PIX_FMT_YUV444P10BE:
> +case AV_PIX_FMT_YUV444P12LE:
> +case AV_PIX_FMT_YUV444P12BE:
> +return VPX_SUBSAMPLING_444;
> +default:
> +av_log(NULL, AV_LOG_ERROR, "Unknown pixel format.");
> +return -1;
> +}
> +}
>

In ffmpeg, the case and switch should be indented at the same level:

switch (a) {
case b:
foo();
break;
default:
bar();
break;
}

What happens if the "default:" case is reached? Is the vpcc atom still
valid? If not, should the muxer error out? Can this even happen at all?

+static int get_vpx_transfer_function(
> +enum AVColorTransferCharacteristic transfer)
> +{
> +  return (transfer == AVCOL_TRC_SMPTEST2084) ? 1 : 0;
> +}
> +
> +static int get_vpx_video_full_range_flag(enum AVColorRange color_range)
> +{
> +return (color_range == AVCOL_RANGE_JPEG) ? 1 : 0;
> +}
>

The (..) ? 1 : 0 construct is unnecessary, you can just return .. (or in
case of non-boolean values, we prefer !!(..)).

I also think it's a bad habit to log generic messages like "unknown pixel
format" without a logging context, the user will never understand what that
means.

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


Re: [FFmpeg-devel] [PATCH] os_support: use the appropriate stat functions matching the stat type

2016-06-14 Thread Michael Niedermayer
On Tue, Jun 14, 2016 at 05:09:01PM +0200, Hendrik Leppkes wrote:
> The stat struct is defined to stati64, which requires using the appropriate 
> wstati/stati functions as well.
> Fixes a whole bunch of compiler warnings as well as build breakage with the 
> decklink avdevice.
> ---
>  libavformat/os_support.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

please apply, there are multiple reports about this IIRC


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

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


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


Re: [FFmpeg-devel] [PATCH 2/3] avformat/utils: in debug mode, print number of streams found before avformat_find_stream_info()

2016-06-14 Thread Michael Niedermayer
On Tue, Jun 14, 2016 at 11:08:54AM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> ---
>  libavformat/utils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

thanks

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH 1/3] avformat/mpegts: enhance logging in trace mode

2016-06-14 Thread Michael Niedermayer
On Tue, Jun 14, 2016 at 11:08:53AM -0700, Aman Gupta wrote:
> From: Aman Gupta 
> 
> ---
>  libavformat/mpegts.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 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: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 5/5] avcodec/ccaption_dec: default rollup to row 10

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

This ensures that captions are written towards the bottom of the screen
when tuning into mid-stream. The row will be reset on the receipt of the
next PAC command. Row 10 was chosen as it corresponds to the value of
"0" in a PAC (see row_map in handle_pac()).
---
 libavcodec/ccaption_dec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 16a7959..4a2db31 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -261,6 +261,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
 /* taking by default roll up to 2 */
 ctx->mode = CCMODE_ROLLUP;
 ctx->rollup = 2;
+ctx->cursor_row = 10;
 ret = ff_ass_subtitle_header(avctx, "Monospace",
  ASS_DEFAULT_FONT_SIZE,
  ASS_DEFAULT_COLOR,
@@ -298,7 +299,7 @@ static void flush_decoder(AVCodecContext *avctx)
 ctx->prev_cmd[1] = 0;
 ctx->mode = CCMODE_ROLLUP;
 ctx->rollup = 2;
-ctx->cursor_row = 0;
+ctx->cursor_row = 10;
 ctx->cursor_column = 0;
 ctx->cursor_font = 0;
 ctx->cursor_color = 0;
-- 
2.8.1

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


[FFmpeg-devel] [PATCH 3/5] avcodec/ccaption_dec: implement positioning for closed captions

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

Positioning math is based on the guidelines in 
https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608
---
 libavcodec/ccaption_dec.c | 29 ++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 0b4a061..16a7959 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -435,7 +435,7 @@ static void roll_up(CCaptionSubContext *ctx)
 
 static int capture_screen(CCaptionSubContext *ctx)
 {
-int i;
+int i, j, tab = 0;
 struct Screen *screen = ctx->screen + ctx->active_screen;
 enum cc_font prev_font = CCFONT_REGULAR;
 av_bprint_clear(>buffer);
@@ -444,15 +444,33 @@ static int capture_screen(CCaptionSubContext *ctx)
 {
 if (CHECK_FLAG(screen->row_used, i)) {
 const char *row = screen->characters[i];
+const char *charset = screen->charsets[i];
+j = 0;
+while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN)
+j++;
+if (!tab || j < tab)
+tab = j;
+}
+}
+
+for (i = 0; screen->row_used && i < SCREEN_ROWS; i++)
+{
+if (CHECK_FLAG(screen->row_used, i)) {
+const char *row = screen->characters[i];
 const char *font = screen->fonts[i];
 const char *charset = screen->charsets[i];
 const char *override;
-int j = 0;
+int x, y, seen_char = 0;
+j = 0;
 
 /* skip leading space */
-while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN)
+while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN && j < 
tab)
 j++;
 
+x = ASS_DEFAULT_PLAYRESX * (0.1 + 0.0250 * j);
+y = ASS_DEFAULT_PLAYRESY * (0.1 + 0.0533 * i);
+av_bprintf(>buffer, "{\\an7}{\\pos(%d,%d)}", x, y);
+
 for (; j < SCREEN_COLUMNS; j++) {
 const char *e_tag = "", *s_tag = "";
 
@@ -487,9 +505,14 @@ static int capture_screen(CCaptionSubContext *ctx)
 override = charset_overrides[(int)charset[j]][(int)row[j]];
 if (override) {
 av_bprintf(>buffer, "%s%s%s", e_tag, s_tag, override);
+seen_char = 1;
+} else if (row[j] == ' ' && !seen_char) {
+av_bprintf(>buffer, "%s%s\\h", e_tag, s_tag);
 } else {
 av_bprintf(>buffer, "%s%s%c", e_tag, s_tag, row[j]);
+seen_char = 1;
 }
+
 }
 av_bprintf(>buffer, "\\N");
 }
-- 
2.8.1

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


[FFmpeg-devel] [PATCH 1/5] avcodec/ccaption_dec: change write_char() to void as return value is unused

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

---
 libavcodec/ccaption_dec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 3b15149..a6d879e 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -315,7 +315,7 @@ static void flush_decoder(AVCodecContext *avctx)
 /**
  * @param ctx closed caption context just to print log
  */
-static int write_char(CCaptionSubContext *ctx, struct Screen *screen, char ch)
+static void write_char(CCaptionSubContext *ctx, struct Screen *screen, char ch)
 {
 uint8_t col = ctx->cursor_column;
 char *row = screen->characters[ctx->cursor_row];
@@ -328,16 +328,16 @@ static int write_char(CCaptionSubContext *ctx, struct 
Screen *screen, char ch)
 charset[col] = ctx->cursor_charset;
 ctx->cursor_charset = CCSET_BASIC_AMERICAN;
 if (ch) ctx->cursor_column++;
-return 0;
+return;
 }
 /* We have extra space at end only for null character */
 else if (col == SCREEN_COLUMNS && ch == 0) {
 row[col] = ch;
-return 0;
+return;
 }
 else {
 av_log(ctx, AV_LOG_WARNING, "Data Ignored since exceeding screen 
width\n");
-return AVERROR_INVALIDDATA;
+return;
 }
 }
 
-- 
2.8.1

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


[FFmpeg-devel] [PATCH 4/5] fate: update sub-cc tests for closed caption positioning

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

---
 tests/ref/fate/sub-cc  |  4 +--
 tests/ref/fate/sub-cc-realtime | 60 +-
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
index 0d5bc77..4cc02d1 100644
--- a/tests/ref/fate/sub-cc
+++ b/tests/ref/fate/sub-cc
@@ -10,5 +10,5 @@ Style: 
Default,Monospace,16,0,0,0,0,100,100,0,0,3,1,0,
 
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:12.36,0:00:40.83,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )
-Dialogue: 0,0:00:40.83,0:00:59.07,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains our number one
+Dialogue: 0,0:00:12.36,0:00:40.83,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio chatter{\i0} )
+Dialogue: 0,0:00:40.83,0:00:59.07,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our number 
one
diff --git a/tests/ref/fate/sub-cc-realtime b/tests/ref/fate/sub-cc-realtime
index c9e6b6c..be800a4 100644
--- a/tests/ref/fate/sub-cc-realtime
+++ b/tests/ref/fate/sub-cc-realtime
@@ -10,33 +10,33 @@ Style: 
Default,Monospace,16,0,0,0,0,100,100,0,0,3,1,0,
 
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
-Dialogue: 0,0:00:14.14,9:59:59.99,Default,,0,0,0,,(
-Dialogue: 0,0:00:15.47,9:59:59.99,Default,,0,0,0,,({\i1} in
-Dialogue: 0,0:00:15.92,9:59:59.99,Default,,0,0,0,,({\i1} inau
-Dialogue: 0,0:00:16.36,9:59:59.99,Default,,0,0,0,,({\i1} inaudi
-Dialogue: 0,0:00:16.81,9:59:59.99,Default,,0,0,0,,({\i1} inaudibl
-Dialogue: 0,0:00:17.25,9:59:59.99,Default,,0,0,0,,({\i1} inaudible 
-Dialogue: 0,0:00:17.70,9:59:59.99,Default,,0,0,0,,({\i1} inaudible ra
-Dialogue: 0,0:00:18.14,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radi
-Dialogue: 0,0:00:18.59,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
-Dialogue: 0,0:00:19.03,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio ch
-Dialogue: 0,0:00:19.48,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio chat
-Dialogue: 0,0:00:19.92,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio chatte
-Dialogue: 0,0:00:20.36,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter
-Dialogue: 0,0:00:21.70,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )
-Dialogue: 0,0:00:42.61,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>>
-Dialogue: 0,0:00:43.05,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> S
-Dialogue: 0,0:00:43.50,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Saf
-Dialogue: 0,0:00:43.94,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safet
-Dialogue: 0,0:00:44.39,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety 
-Dialogue: 0,0:00:44.83,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety re
-Dialogue: 0,0:00:45.28,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety rema
-Dialogue: 0,0:00:45.72,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remain
-Dialogue: 0,0:00:46.17,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains 
-Dialogue: 0,0:00:46.61,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains ou
-Dialogue: 0,0:00:47.06,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains our 
-Dialogue: 0,0:00:47.50,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains our nu
-Dialogue: 0,0:00:47.95,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains our numb
-Dialogue: 0,0:00:48.39,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains our number
-Dialogue: 0,0:00:48.84,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains our number o
-Dialogue: 0,0:00:49.28,9:59:59.99,Default,,0,0,0,,({\i1} inaudible radio 
chatter{\i0} )\N>> Safety remains our number one
+Dialogue: 0,0:00:14.14,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}(
+Dialogue: 0,0:00:15.47,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} in
+Dialogue: 0,0:00:15.92,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inau
+Dialogue: 0,0:00:16.36,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudi
+Dialogue: 0,0:00:16.81,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudibl
+Dialogue: 0,0:00:17.25,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible 
+Dialogue: 0,0:00:17.70,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible ra
+Dialogue: 0,0:00:18.14,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radi
+Dialogue: 0,0:00:18.59,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio 
+Dialogue: 0,0:00:19.03,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio ch

[FFmpeg-devel] [PATCH 2/5] avcodec/ccaption_dec: implement tab offset commands

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

---
 libavcodec/ccaption_dec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index a6d879e..0b4a061 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -713,6 +713,11 @@ static void process_cc608(CCaptionSubContext *ctx, int64_t 
pts, uint8_t hi, uint
 /* Standard characters (always in pairs) */
 handle_char(ctx, hi, lo, pts);
 ctx->prev_cmd[0] = ctx->prev_cmd[1] = 0;
+} else if (hi == 0x17 && lo >= 0x21 && lo <= 0x23) {
+/* Tab offsets (spacing) */
+for (int i = 0; i < lo - 0x20; i++) {
+handle_char(ctx, ' ', 0, pts);
+}
 } else {
 /* Ignoring all other non data code */
 ff_dlog(ctx, "Unknown command 0x%hhx 0x%hhx\n", hi, lo);
-- 
2.8.1

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


[FFmpeg-devel] [PATCH 3/3] avformat/mpegts: include stream types for mpeg2 and aac

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

this removes the need to probe to discover mpeg2 and aac streams
inside mpegts containers, thus speeding up initial playback.
---
 libavformat/mpegts.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 6acb797..f46984d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -700,6 +700,7 @@ static const StreamType ISO_types[] = {
 { 0x11, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC_LATM   }, /* LATM syntax */
 #endif
 { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264   },
+{ 0x1c, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AAC},
 { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264   },
 { 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000   },
 { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC   },
@@ -726,6 +727,7 @@ static const StreamType HDMV_types[] = {
 
 /* ATSC ? */
 static const StreamType MISC_types[] = {
+{ 0x80, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_MPEG2VIDEO },
 { 0x81, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
 { 0x8a, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
 { 0 },
-- 
2.8.1

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


[FFmpeg-devel] [PATCH 1/3] avformat/mpegts: enhance logging in trace mode

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

---
 libavformat/mpegts.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 4d1bc6d..6acb797 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -446,7 +446,7 @@ static MpegTSFilter *mpegts_open_filter(MpegTSContext *ts, 
unsigned int pid,
 {
 MpegTSFilter *filter;
 
-av_log(ts->stream, AV_LOG_TRACE, "Filter: pid=0x%x\n", pid);
+av_log(ts->stream, AV_LOG_TRACE, "Filter: pid=0x%x type=%d\n", pid, type);
 
 if (pid >= NB_PID_MAX || ts->pids[pid])
 return NULL;
@@ -1890,8 +1890,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t 
*section, int section_len
 if (skip_identical(h, tssf))
 return;
 
-av_log(ts->stream, AV_LOG_TRACE, "sid=0x%x sec_num=%d/%d version=%d\n",
-h->id, h->sec_num, h->last_sec_num, h->version);
+av_log(ts->stream, AV_LOG_TRACE, "sid=0x%x sec_num=%d/%d version=%d 
tid=%d\n",
+h->id, h->sec_num, h->last_sec_num, h->version, h->tid);
 
 if (h->tid != PMT_TID)
 return;
-- 
2.8.1

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


[FFmpeg-devel] [PATCH 2/3] avformat/utils: in debug mode, print number of streams found before avformat_find_stream_info()

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 25c9a1b..494379a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3297,8 +3297,8 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
 }
 
 if (ic->pb)
-av_log(ic, AV_LOG_DEBUG, "Before avformat_find_stream_info() pos: 
%"PRId64" bytes read:%"PRId64" seeks:%d\n",
-   avio_tell(ic->pb), ic->pb->bytes_read, ic->pb->seek_count);
+av_log(ic, AV_LOG_DEBUG, "Before avformat_find_stream_info() pos: 
%"PRId64" bytes read:%"PRId64" seeks:%d nb_streams:%d\n",
+   avio_tell(ic->pb), ic->pb->bytes_read, ic->pb->seek_count, 
ic->nb_streams);
 
 for (i = 0; i < ic->nb_streams; i++) {
 const AVCodec *codec;
-- 
2.8.1

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


[FFmpeg-devel] [PATCH] avcodec/utils: ensure conversion from ass to ass_with_timings works with unknown durations

2016-06-14 Thread Aman Gupta
From: Aman Gupta 

the eia_608 decoder with real_time=1 emits subtitles with an unknown
duration, which were getting converted into ass incorrectly before this
patch.
---
 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 402a9d8..1047a74 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2554,7 +2554,7 @@ static int convert_sub_to_old_ass_form(AVSubtitle *sub, 
const AVPacket *pkt, AVR
 
 /* rescale timing to ASS time base (ms) */
 ts_start = av_rescale_q(pkt->pts, tb, av_make_q(1, 100));
-if (pkt->duration != -1)
+if (pkt->duration != -1 && sub->end_display_time != -1)
 ts_duration = av_rescale_q(pkt->duration, tb, av_make_q(1, 100));
 sub->end_display_time = FFMAX(sub->end_display_time, 10 * ts_duration);
 
-- 
2.8.1

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


Re: [FFmpeg-devel] [PATCH] lavf: add textdata virtual demuxer and demuxer

2016-06-14 Thread Stefano Sabatini
On date Sunday 2016-06-05 12:59:48 +0200, Stefano Sabatini encoded:
> On date Thursday 2016-05-19 18:50:17 +0200, Stefano Sabatini encoded:
> > On date Thursday 2016-05-19 18:45:22 +0200, Stefano Sabatini encoded:
> > > This format is useful to inject custom user data into streams.
> > > ---
> > >  doc/demuxers.texi   |  40 +
> > >  doc/muxers.texi |  31 +++
> > >  libavformat/Makefile|   2 +
> > >  libavformat/allformats.c|   1 +
> > >  libavformat/fftextdatadec.c | 212 
> > > 
> > >  libavformat/fftextdataenc.c | 103 +
> > >  6 files changed, 389 insertions(+)
> > >  create mode 100644 libavformat/fftextdatadec.c
> > >  create mode 100644 libavformat/fftextdataenc.c
> > 
> > Short explanation: I needed some way to inject serialized data packets
> > through stream-copy, so I implemented this format. The other patches
> > are related (since I needed to inject timed ID3 data).
> > 
> > I'm fine with extending it with other options, or to use an
> > alternative solution (if exists).
> 
> Please tell if you consider this format acceptable.
> 
> One obvious limitation is that it can't store codec properties (nor
> the codec name, nor more than one stream). One possibility would be to
> dump the serialization of AVCodecContext/AVCodecParameters, even if
> these would require a serious limitation on the format (since that
> means it would require to use it only as intermediary format, for
> muxing and demuxing using the same version of FFmpeg, which is fine in
> my use case).

Ping. Any hope to get this integrated, or there is someone against it?
-- 
FFmpeg = Fiendish & Faithful Magnificient Pure Everlasting Gladiator
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] fate: add afade tes

2016-06-14 Thread Petru Rares Sincraian
I look the code for some time but I don't know how to express the dependency. I 
think it's ok because it uses FATE_AFILTER_SAMPLES and then this variable is 
added to FATE_SAMPLES_AVCONV.


Muhammad which command did you execute to reproduce the error?



Thanks,

Petru Rares.


From: ffmpeg-devel  on behalf of Michael 
Niedermayer 
Sent: Tuesday, June 14, 2016 4:30:24 AM
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] [PATCH] fate: add afade tes

On Mon, Jun 13, 2016 at 01:34:39PM +0700, Muhammad Faiz wrote:
> On Sun, Jun 12, 2016 at 8:14 PM, Michael Niedermayer
>  wrote:
> > On Sun, Jun 12, 2016 at 09:37:28AM +, Petru Rares Sincraian wrote:
> >> Hi there,
> >>
> >> I'm sorry, I hadn't considered mingw. Here is the patch without the 
> >> filter-afade-ihsin.
> >
> > applied
> >
> fail without SAMPLES

should be fixed

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] Add support for vp9 in iso-bmff

2016-06-14 Thread KongQun Yang
Patchset v2 addresses review comments. Thanks everyone for the review.

Here is a summary of the changes in patchset v2:

1.  Add "-strict -2" requirement, since the feature is still being reviewed
and may subject to change.
2. Rename vpx.c/vpx.h to vpc.c/vpc.h to align with avc and hevc.
3. Use av_pix_fmt_desc_get(pixel_format)->comp[0].depth suggested by Ronald
to get bit depth
As for the comments on color space from James, the structure is
specific to "vp in mp4" specification, so we cannot reuse the code from
libavcodec or libvpx.


-- KongQun Yang (KQ)

On Mon, Jun 13, 2016 at 2:26 PM, Kongqun Yang  wrote:

> Implemented according to the draft specification
> "VP Codec ISO Media File Format Binding":
>
> http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding
>
> Change-Id: Iaa7ddf5524b17e8d79cd1923b26f096d6e91
> ---
>  libavformat/Makefile |   2 +-
>  libavformat/isom.c   |   3 +
>  libavformat/movenc.c |  26 +
>  libavformat/vpc.c| 151
> +++
>  libavformat/vpc.h|  44 +++
>  5 files changed, 225 insertions(+), 1 deletion(-)
>  create mode 100644 libavformat/vpc.c
>  create mode 100644 libavformat/vpc.h
>
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 6684ead..be8c261 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -276,7 +276,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
>  OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
>  OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
>  OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o
> -OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o \
> +OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpc.o \
>  movenchint.o mov_chan.o rtp.o
> \
>  movenccenc.o rawutils.o
>  OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index b1757e2..9a65268 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -59,6 +59,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
>  { AV_CODEC_ID_AC3 , 0xA5 },
>  { AV_CODEC_ID_EAC3, 0xA6 },
>  { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
> +{ AV_CODEC_ID_VP9 , 0xC0 }, /* non standard, update when
> there is a standard value */
>  { AV_CODEC_ID_TSCC2   , 0xD0 }, /* non standard, camtasia uses it
> */
>  { AV_CODEC_ID_VORBIS  , 0xDD }, /* non standard, gpac uses it */
>  { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see
> unsupported-embedded-subs-2.mp4 */
> @@ -179,6 +180,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
>  { AV_CODEC_ID_H264, MKTAG('a', 'i', 'v', 'x') }, /* XAVC 4:2:2 10bit
> */
>  { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
>
> +{ AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
> +
>  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
>  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple
> MPEG-1 Camcorder */
>  { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 2f00091..551f0e6 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -49,6 +49,7 @@
>  #include "hevc.h"
>  #include "rtpenc.h"
>  #include "mov_chan.h"
> +#include "vpc.h"
>
>  static const AVOption options[] = {
>  { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags),
> AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX,
> AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
> @@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb,
> MOVTrack *track)
>  return update_size(pb, pos);
>  }
>
> +static int mov_write_vpcc_tag(AVIOContext *pb, MOVTrack *track)
> +{
> +int64_t pos = avio_tell(pb);
> +
> +avio_wb32(pb, 0);
> +ffio_wfourcc(pb, "vpcC");
> +avio_wb32(pb, 0); /* version & flags */
> +ff_isom_write_vpcc(pb, track->par);
> +return update_size(pb, pos);
> +}
> +
>  static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
>  {
>  int64_t pos = avio_tell(pb);
> @@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s,
> MOVTrack *track)
>
>  if  (track->par->codec_id == AV_CODEC_ID_H264)  tag =
> MKTAG('a','v','c','1');
>  else if (track->par->codec_id == AV_CODEC_ID_HEVC)  tag =
> MKTAG('h','e','v','1');
> +else if (track->par->codec_id == AV_CODEC_ID_VP9)   tag =
> MKTAG('v','p','0','9');
>  else if (track->par->codec_id == AV_CODEC_ID_AC3)   tag =
> MKTAG('a','c','-','3');
>  else if (track->par->codec_id == AV_CODEC_ID_EAC3)  tag =
> MKTAG('e','c','-','3');
>  else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag =
> MKTAG('d','r','a','c');
> @@ -1758,6 +1771,8 @@ static int 

Re: [FFmpeg-devel] [PATCH] ffprobe: Support adding av_log output to frames

2016-06-14 Thread Stefano Sabatini
On date Wednesday 2016-06-08 18:20:39 +0200, Michael Niedermayer encoded:
> On Sun, Jun 05, 2016 at 12:56:08PM +0200, Stefano Sabatini wrote:
> > On date Tuesday 2016-05-31 21:23:27 +0200, Michael Niedermayer encoded:
> > > adding demuxer and other logs should be easy
> > > This forces single threaded decoding for simplicity
> > > It also requires pthreads, this could be avoided either with
> > > some lockless tricks or simply by assuming av_log would never be called 
> > > from
> > > another thread.
> > > 
> > > doc/ffprobe.xsd update missing (TODO & help welcome)
> > > 
> > > Fixes Ticket5521
> > > 
> > > Signed-off-by: Michael Niedermayer 
> > > ---
> > >  ffprobe.c |  154 
> > > -
> > >  1 file changed, 153 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/ffprobe.c b/ffprobe.c
> > > index a7e329c..07b61ec 100644
> > > --- a/ffprobe.c
> > > +++ b/ffprobe.c
> > > @@ -49,6 +49,19 @@
> > >  #include "libpostproc/postprocess.h"
> > >  #include "cmdutils.h"
> > >  
> > 
> > > +#if HAVE_PTHREADS
> > > +#  include 
> > > +#else
> > > +#  ifdef pthread_mutex_lock
> > > +#undef pthread_mutex_lock
> > > +#  endif
> > > +#  define pthread_mutex_lock(a)
> > > +#  ifdef pthread_mutex_unlock
> > > +#undef pthread_mutex_unlock
> > > +#  endif
> > > +#  define pthread_mutex_unlock(a)
> > > +#endif
> > > +
> > 
> > any chance to move this ifdeffery to lavu?
> 
> iam not sure what you suggest exactly ?

Forget about it.

[...]
> > > +#if HAVE_PTHREADS
> > > +ret = pthread_mutex_init(_mutex, NULL);
> > > +if (ret != 0) {
> > > +goto end;
> > > +}
> > > +#endif
> > > +av_log_set_callback(log_callback);
> > > +
> > >  av_log_set_flags(AV_LOG_SKIP_REPEATED);
> > >  register_exit(ffprobe_cleanup);
> > 
> > I'm not really sure about storing the log in frame, since they could
> > come from any context, not necessarily related to decoding.
> > 
> > OTOH, I'm not really sure how such feature could be implemented in a
> > really clean way.
> > 
> > About frame decoding errors, we could store an error in the decoded
> > frame itself.
> 

> I dont know what exactly is wanted ?
> 

I mean, we already have the AVFrame.decode_error_flags we could expose
to the user.

> What i found interresting was to partition all av_log into
> closest related sections like decoder/demuxer/filter/...
> and add them there
> so that detailed information, not limited to errors about frame and
> packet related information can be associated with them
> this patch was just a step toward that
> if that feature isnt wanted we can drop the patch

I think this patch is interesting, but I don't want to clutter the
code too much, especially if we found a more general design which
could deprecate this one.

The problem with this approach is that the log is contained in the
frame element, when it could come from other parts of the code as
well.

One option could be to define a -show_logs options, and optionally add
a filter specifying the contexts. Just storing the log in the frame
elements sounds a bit weird to me.
-- 
FFmpeg = Fanciful and Friendly Merciless Plastic EnGine
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] warnings: Truncating likely oversized PPS

2016-06-14 Thread Stefano Sabatini
On date Sunday 2016-06-05 16:16:15 +0200, Robert Krüger encoded:
> Hi,
> 
> I'm observing tons of these messages in my logs for mxf files from a number
> of professional cameras.
> 

> Would it help to submit a sample, so someone could check if the warning
> makes sense? I'm close to hacking the code locally to suppress this warning
> because it seems it is logged once per frame thus filling our logs.

Sure, and please open a ticket with the sample.
-- 
FFmpeg = Fast & Fundamentalist Mythic Programmable Enlightening Governor
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/utils: fix timestamp trace log in estimate_timings() function

2016-06-14 Thread Stefano Sabatini
On date Sunday 2016-06-05 15:42:05 +0200, Michael Niedermayer encoded:
> On Sun, Jun 05, 2016 at 12:36:30PM +0200, Stefano Sabatini wrote:
> > Use the correct timebase, also replace "stream" with "format" in the
> > context of the format.
> > ---
> >  libavformat/utils.c | 8 
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> ok

Applied, thanks.
-- 
FFmpeg = Frightening and Formidable Merciless Pacific Elaborated Gadget
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavformat/mpegtsenc: improved cbr mode pcr accuracy

2016-06-14 Thread Michael Niedermayer
On Tue, Jun 14, 2016 at 04:25:50PM +0300, Alexander Shumsky wrote:
> 08.06.2016 18:48, Michael Niedermayer пишет:
> >did you test this ?
> >if so please provide information & test results from it
> >
> >also has this been tested with multiple programs ?
> 
> We have tested this with StreamGuru MPEG Analyzer. With default 20ms
> PCR interval patched version gives max PCR interval 21ms while with
> unpatched version max interval is 26ms (See screenshots).

The big problem of our TS muxer is the packet interleaving
the granularity of the interval is too big
This also results in the PCR being a bit unevenly spaced

The code should be changed to allow optional packet interleaving at
finer granularity to improve compliance of some high bitrate cases
If things can be interleaved with finer granularity then PCR too
can more easily be made more evenly spaced.

Please correct me if iam wrong but your patch basically makes an
exception to the (non optimal) interleaver for PCR only
Isnt this a hack on top of the current non optimal code?

also  MPEG-TS requires the interval to be < 100ms
(see 2.7.2 Frequency of coding the program clock reference)

both 21 and 26ms are within that


[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


Re: [FFmpeg-devel] [PATCH] libavformat/mpegtsenc: improved cbr mode pcr accuracy

2016-06-14 Thread Alexander Shumsky

08.06.2016 18:48, Michael Niedermayer пишет:

did you test this ?
if so please provide information & test results from it

also has this been tested with multiple programs ?


We have tested this with StreamGuru MPEG Analyzer. With default 20ms PCR 
interval patched version gives max PCR interval 21ms while with 
unpatched version max interval is 26ms (See screenshots).




--
С уважением, Шумский Александр
Компания NetUP

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


Re: [FFmpeg-devel] [PATCH 1/4] lavc/h264: move green meta logging out of the sei decoding

2016-06-14 Thread Clément Bœsch
On Tue, Jun 14, 2016 at 12:01:25AM +0200, Hendrik Leppkes wrote:
> On Mon, Jun 13, 2016 at 11:02 PM, Clément Bœsch  wrote:
> > This will simplify the next Libav merge where SEI decoding doesn't have
> > access to the debug level anymore.
> 
> This whole business looks rather fragile and wtf'ish, but its better
> then before and should be fine. So the entire set LGTM.

patchset applied, thanks

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH 1/5] rtpdec_vp9: Make sure to free the temp buffer on close

2016-06-14 Thread Thomas Volkert

On 13.06.2016 21:03, Thomas Volkert wrote:

From: Martin Storsjö 

Signed-off-by: Martin Storsjö 
---
  libavformat/rtpdec_vp9.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/libavformat/rtpdec_vp9.c b/libavformat/rtpdec_vp9.c
index e50bede..7b1c38f 100644
--- a/libavformat/rtpdec_vp9.c
+++ b/libavformat/rtpdec_vp9.c
@@ -279,11 +279,17 @@ static int vp9_handle_packet(AVFormatContext *ctx, 
PayloadContext *rtp_vp9_ctx,
  return 0;
  }
  
+static void vp9_close_context(PayloadContext *vp9)

+{
+ffio_free_dyn_buf(>buf);
+}
+
  RTPDynamicProtocolHandler ff_vp9_dynamic_handler = {
  .enc_name = "VP9",
  .codec_type   = AVMEDIA_TYPE_VIDEO,
  .codec_id = AV_CODEC_ID_VP9,
  .priv_data_size   = sizeof(PayloadContext),
  .init = vp9_init,
+.close= vp9_close_context,
  .parse_packet = vp9_handle_packet
  };


all 5 patches pushed

Best regards,
Thomas.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel