Re: [FFmpeg-devel] [PATCH] movenc/isom: update vpcC box to the latest draft specification

2017-04-21 Thread KongQun Yang
Hi Hendrik,

Thanks for working on it. Version needs to be updated as well:
https://github.com/FFmpeg/FFmpeg/blob/b905ba5bc18c89c7fccd862179575562ef19/libavformat/movenc.c#L1115.
Suggest moving it into ff_isom_write_vpcc function too.

-- KongQun Yang (KQ)

On Tue, Apr 18, 2017 at 7:30 AM, Hendrik Leppkes 
wrote:

> This brings our generation of the vpcC box up to date to the latest
> draft version of the VP Codec ISO Media File Format Binding.
>
> Specifically, color/transfer properties are now written with values
> based on ISO/IEC 23001-8, which is the same reference specification the
> AVColor* enumerations are based on.
> ---
>  libavformat/vpcc.c | 53 --
> ---
>  1 file changed, 4 insertions(+), 49 deletions(-)
>
> diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c
> index 2390e1711c..d20ca9edc2 100644
> --- a/libavformat/vpcc.c
> +++ b/libavformat/vpcc.c
> @@ -23,44 +23,6 @@
>  #include "libavutil/pixfmt.h"
>  #include "vpcc.h"
>
> -enum VpxColorSpace
> -{
> -VPX_COLOR_SPACE_UNSPECIFIED = 0,
> -VPX_COLOR_SPACE_BT601 = 1,
> -VPX_COLOR_SPACE_BT709 = 2,
> -VPX_COLOR_SPACE_SMPTE_170 = 3,
> -VPX_COLOR_SPACE_SMPTE_240 = 4,
> -VPX_COLOR_SPACE_BT2020_NCL = 5,
> -VPX_COLOR_SPACE_BT2020_CL = 6,
> -VPX_COLOR_SPACE_RGB = 7,
> -};
> -
> -static int get_vpx_color_space(AVFormatContext *s,
> -   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_UNSPECIFIED:
> -return VPX_COLOR_SPACE_UNSPECIFIED;
> -case AVCOL_SPC_BT470BG:
> -return VPX_COLOR_SPACE_BT601;
> -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:
> -av_log(s, AV_LOG_ERROR, "Unsupported color space (%d)\n",
> color_space);
> -return -1;
> -}
> -}
> -
>  enum VPX_CHROMA_SUBSAMPLING
>  {
>  VPX_SUBSAMPLING_420_VERTICAL = 0,
> @@ -100,12 +62,6 @@ static int get_bit_depth(AVFormatContext *s, enum
> AVPixelFormat pixel_format)
>  return desc->comp[0].depth;
>  }
>
> -static int get_vpx_transfer_function(
> -enum AVColorTransferCharacteristic transfer)
> -{
> -return transfer == AVCOL_TRC_SMPTEST2084;
> -}
> -
>  static int get_vpx_video_full_range_flag(enum AVColorRange color_range)
>  {
>  return color_range == AVCOL_RANGE_JPEG;
> @@ -117,10 +73,8 @@ int ff_isom_write_vpcc(AVFormatContext *s,
> AVIOContext *pb,
>  int profile = par->profile;
>  int level = par->level == FF_LEVEL_UNKNOWN ? 0 : par->level;
>  int bit_depth = get_bit_depth(s, par->format);
> -int vpx_color_space = get_vpx_color_space(s, par->color_space);
>  int vpx_chroma_subsampling =
>  get_vpx_chroma_subsampling(s, par->format, par->chroma_location);
> -int vpx_transfer_function = get_vpx_transfer_function(par-
> >color_trc);
>  int vpx_video_full_range_flag =
>  get_vpx_video_full_range_flag(par->color_range);
>
> @@ -138,9 +92,10 @@ int ff_isom_write_vpcc(AVFormatContext *s,
> AVIOContext *pb,
>
>  avio_w8(pb, profile);
>  avio_w8(pb, level);
> -avio_w8(pb, (bit_depth << 4) | vpx_color_space);
> -avio_w8(pb, (vpx_chroma_subsampling << 4) | (vpx_transfer_function <<
> 1) |
> -vpx_video_full_range_flag);
> +avio_w8(pb, (bit_depth << 4) | (vpx_chroma_subsampling << 1) |
> vpx_video_full_range_flag);
> +avio_w8(pb, par->color_primaries);
> +avio_w8(pb, par->color_trc);
> +avio_w8(pb, par->color_space);
>
>  // vp9 does not have codec initialization data.
>  avio_wb16(pb, 0);
> --
> 2.12.2.windows.2
>
> ___
> 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] movenc/isom: update vpcC box to the latest draft specification

2017-04-21 Thread KongQun Yang
Correct. There is a mistake in the spec. I have created a pull request to
fix that earlier today: https://github.com/webmproject/vp9-dash/pull/69


-- KongQun Yang (KQ)

On Fri, Apr 21, 2017 at 2:52 PM, James Almer  wrote:

> On 4/21/2017 6:47 PM, James Almer wrote:
>
>> On 4/21/2017 6:34 PM, Hendrik Leppkes wrote:
>>
>>> On Fri, Apr 21, 2017 at 11:25 PM, KongQun Yang
>>>  wrote:
>>>
>>>> Hi Hendrik,
>>>>
>>>> Thanks for working on it. Version needs to be updated as well:
>>>> https://github.com/FFmpeg/FFmpeg/blob/b905ba5bc18c89c7fccd86
>>>> 2179575562ef19/libavformat/movenc.c#L1115.
>>>> Suggest moving it into ff_isom_write_vpcc function too.
>>>>
>>>>
>>> The actual value of the version field doesn't seem to be mentioned in
>>> the specification anywhere.
>>> https://github.com/webmproject/vp9-dash/blob/master/VPCodecI
>>> SOMediaFileFormatBinding.md
>>>
>>> The only version info I can see is the v1.0 at the top, but thats
>>> hardly a direct correlation to single integer version field in the mp4
>>> box.
>>>
>>> Or did I miss it somewhere?
>>>
>>> - Hendrik
>>>
>>
>> https://github.com/webmproject/vp9-dash/commit/7961d0feb5bd8
>> 79c84aa71d208d5df30bd5d5192
>>
>
> In fact, i think that commit is wrong. It changed the flags field from 0
> to 1. As per the spec:
>
> aligned(8) class FullBox(unsigned int(32) boxtype, unsigned int(8) v,
>  bit(24) f)
>extends Box(boxtype) {
>unsigned int(8)   version = v;
>bit(24) flags = f;
> }
>
> So they are defining the version number as "version" in
> VPCodecISOMediaFileFormatBinding.md
>
> in any case, version is now 1 instead of 0.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] movenc/isom: update vpcC box to the latest draft specification

2017-04-24 Thread KongQun Yang
-- KongQun Yang (KQ)

On Fri, Apr 21, 2017 at 4:49 PM, Hendrik Leppkes 
wrote:

> On Sat, Apr 22, 2017 at 1:25 AM, Hendrik Leppkes 
> wrote:
> > This brings our generation of the vpcC box up to date to version 1.0
> > of the VP Codec ISO Media File Format Binding.
> >
> > Specifically, color/transfer properties are now written with values
> > based on ISO/IEC 23001-8, which is the same reference specification the
> > AVColor* enumerations are based on.
> > ---
> >  libavformat/movenc.c |  3 ++-
> >  libavformat/vpcc.c   | 55 +-
> --
> >  2 files changed, 7 insertions(+), 51 deletions(-)
> >
>
> Actually I should probably update the main commit message to mention
> that its v1.0 and not a draft any longer?
>

SGTM. Should we remove the experimental check as well:
https://github.com/FFmpeg/FFmpeg/blob/b905ba5bc18c89c7fccd862179575562ef19/libavformat/movenc.c#L5989
?


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


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

2016-06-10 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 |  15 +
 libavformat/vpx.c| 170 +++
 libavformat/vpx.h|  33 ++
 5 files changed, 222 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/vpx.c
 create mode 100644 libavformat/vpx.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 6684ead..33d6027 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 vpx.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..1471b12 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -49,6 +49,7 @@
 #include "hevc.h"
 #include "rtpenc.h"
 #include "mov_chan.h"
+#include "vpx.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 

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

2016-06-13 Thread Kongqun Yang
 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 > 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;
+  }
+}
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 track->timescale = st->codecpar->sample_rate;
 if (!st->codecpar->frame_size && 
!av_get_bits_per_sample(st->codecpar->codec_id)) {
diff --git a/libavformat/vpc.c b/libavformat/vpc.c
new file mode 100644
index 000..d28c4f5
--- /dev/null
+++ b/libavformat/vpc.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 KongQun Yang (kqy...@google.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "vpc.h"
+
+enum VpxColorSpace
+{
+VPX_COLOR_SPACE_UNSPECIFIED = 0,
+VPX_COLOR_SPACE_BT601 = 1,
+VPX_COLOR_SPACE_BT709 = 2,
+VPX_COLOR_SPACE_SMPTE_170 = 3,
+VPX_COLOR_SPACE_SMPTE_240 = 4,
+VPX_COLOR_SPACE_BT2020_NCL = 5,
+VPX_COLOR_SPACE_BT2020_CL = 6,
+VPX_COLOR_SPACE_RGB = 7,
+};
+
+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;
+}
+}
+
+enum VPX_CHROMA_SUBSAMPLING
+{
+VPX_SUBSAMPLING_420_VERTICAL = 0,
+VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA = 1,
+VPX_SUBSAMPLING_422 = 2,
+VPX_SUBSAMPLING_444 = 3,
+};
+
+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;
+}
+}
+
+static int get_bit_depth(enum AVPixelFormat pixel_format)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pixel_format);
+if (desc == NULL) {
+av_log(NULL, AV_LOG_ERROR, "Unknown pixel format.");
+retu

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)
&g

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

2016-06-14 Thread Kongqun Yang
 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 > 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;
+  }
+}
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 track->timescale = st->codecpar->sample_rate;
 if (!st->codecpar->frame_size && 
!av_get_bits_per_sample(st->codecpar->codec_id)) {
diff --git a/libavformat/vpc.c b/libavformat/vpc.c
new file mode 100644
index 000..d28c4f5
--- /dev/null
+++ b/libavformat/vpc.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 KongQun Yang (kqy...@google.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "vpc.h"
+
+enum VpxColorSpace
+{
+VPX_COLOR_SPACE_UNSPECIFIED = 0,
+VPX_COLOR_SPACE_BT601 = 1,
+VPX_COLOR_SPACE_BT709 = 2,
+VPX_COLOR_SPACE_SMPTE_170 = 3,
+VPX_COLOR_SPACE_SMPTE_240 = 4,
+VPX_COLOR_SPACE_BT2020_NCL = 5,
+VPX_COLOR_SPACE_BT2020_CL = 6,
+VPX_COLOR_SPACE_RGB = 7,
+};
+
+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;
+}
+}
+
+enum VPX_CHROMA_SUBSAMPLING
+{
+VPX_SUBSAMPLING_420_VERTICAL = 0,
+VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA = 1,
+VPX_SUBSAMPLING_422 = 2,
+VPX_SUBSAMPLING_444 = 3,
+};
+
+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;
+}
+}
+
+static int get_bit_depth(enum AVPixelFormat pixel_format)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pixel_format);
+if (desc == NULL) {
+av_log(NULL, AV_LOG_ERROR, "Unknown pixel format.");
+retu

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

2016-06-14 Thread Kongqun Yang
_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 > 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;
+}
+}
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 track->timescale = st->codecpar->sample_rate;
 if (!st->codecpar->frame_size && 
!av_get_bits_per_sample(st->codecpar->codec_id)) {
diff --git a/libavformat/vpc.c b/libavformat/vpc.c
new file mode 100644
index 000..7c50b94
--- /dev/null
+++ b/libavformat/vpc.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 KongQun Yang (kqy...@google.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "vpc.h"
+
+enum VpxColorSpace
+{
+VPX_COLOR_SPACE_UNSPECIFIED = 0,
+VPX_COLOR_SPACE_BT601 = 1,
+VPX_COLOR_SPACE_BT709 = 2,
+VPX_COLOR_SPACE_SMPTE_170 = 3,
+VPX_COLOR_SPACE_SMPTE_240 = 4,
+VPX_COLOR_SPACE_BT2020_NCL = 5,
+VPX_COLOR_SPACE_BT2020_CL = 6,
+VPX_COLOR_SPACE_RGB = 7,
+};
+
+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_UNSPECIFIED:
+return VPX_COLOR_SPACE_UNSPECIFIED;
+case AVCOL_SPC_BT470BG:
+return VPX_COLOR_SPACE_BT601;
+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:
+av_log(NULL, AV_LOG_ERROR, "Unsupported color space (%d)\n",
+   color_space);
+return -1;
+}
+}
+
+enum VPX_CHROMA_SUBSAMPLING
+{
+VPX_SUBSAMPLING_420_VERTICAL = 0,
+VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA = 1,
+VPX_SUBSAMPLING_422 = 2,
+VPX_SUBSAMPLING_444 = 3,
+};
+
+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, "Unsupported pixel format (%d)\n",
+   pixel_format);
+return -1;
+}
+}
+
+static int get_bit_depth(enum AV

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

2016-06-14 Thread Kongqun Yang
_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 > 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;
+}
+}
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 track->timescale = st->codecpar->sample_rate;
 if (!st->codecpar->frame_size && 
!av_get_bits_per_sample(st->codecpar->codec_id)) {
diff --git a/libavformat/vpc.c b/libavformat/vpc.c
new file mode 100644
index 000..890c5a6
--- /dev/null
+++ b/libavformat/vpc.c
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 KongQun Yang (kqy...@google.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "vpc.h"
+
+enum VpxColorSpace
+{
+VPX_COLOR_SPACE_UNSPECIFIED = 0,
+VPX_COLOR_SPACE_BT601 = 1,
+VPX_COLOR_SPACE_BT709 = 2,
+VPX_COLOR_SPACE_SMPTE_170 = 3,
+VPX_COLOR_SPACE_SMPTE_240 = 4,
+VPX_COLOR_SPACE_BT2020_NCL = 5,
+VPX_COLOR_SPACE_BT2020_CL = 6,
+VPX_COLOR_SPACE_RGB = 7,
+};
+
+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_UNSPECIFIED:
+return VPX_COLOR_SPACE_UNSPECIFIED;
+case AVCOL_SPC_BT470BG:
+return VPX_COLOR_SPACE_BT601;
+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:
+av_log(NULL, AV_LOG_ERROR, "Unsupported color space (%d)\n",
+   color_space);
+return -1;
+}
+}
+
+enum VPX_CHROMA_SUBSAMPLING
+{
+VPX_SUBSAMPLING_420_VERTICAL = 0,
+VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA = 1,
+VPX_SUBSAMPLING_422 = 2,
+VPX_SUBSAMPLING_444 = 3,
+};
+
+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, "Unsupported pixel format (%d)\n",
+   pixel_format);
+return -1;
+}
+}
+
+static int get_bit_depth(enum AV

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 v6] Add experimental support for vp9 in iso-bmff

2016-06-14 Thread Kongqun Yang
ite_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 > 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;
+}
+}
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 track->timescale = st->codecpar->sample_rate;
 if (!st->codecpar->frame_size && 
!av_get_bits_per_sample(st->codecpar->codec_id)) {
diff --git a/libavformat/vpc.c b/libavformat/vpc.c
new file mode 100644
index 000..cf17cf2
--- /dev/null
+++ b/libavformat/vpc.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 KongQun Yang (kqy...@google.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "vpc.h"
+
+enum VpxColorSpace
+{
+VPX_COLOR_SPACE_UNSPECIFIED = 0,
+VPX_COLOR_SPACE_BT601 = 1,
+VPX_COLOR_SPACE_BT709 = 2,
+VPX_COLOR_SPACE_SMPTE_170 = 3,
+VPX_COLOR_SPACE_SMPTE_240 = 4,
+VPX_COLOR_SPACE_BT2020_NCL = 5,
+VPX_COLOR_SPACE_BT2020_CL = 6,
+VPX_COLOR_SPACE_RGB = 7,
+};
+
+static int get_vpx_color_space(AVIOContext *pb, 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_UNSPECIFIED:
+return VPX_COLOR_SPACE_UNSPECIFIED;
+case AVCOL_SPC_BT470BG:
+return VPX_COLOR_SPACE_BT601;
+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:
+av_log(pb, AV_LOG_ERROR, "Unsupported color space (%d)\n", 
color_space);
+return -1;
+}
+}
+
+enum VPX_CHROMA_SUBSAMPLING
+{
+VPX_SUBSAMPLING_420_VERTICAL = 0,
+VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA = 1,
+VPX_SUBSAMPLING_422 = 2,
+VPX_SUBSAMPLING_444 = 3,
+};
+
+static int get_vpx_chroma_subsampling(AVIOContext *pb,
+  enum AVPixelFormat pixel_format,
+  enum AVChromaLocation chroma_location)
+{
+int chroma_w, chroma_h;
+if (av_pix_fmt_get_chroma_sub_sample(pixel_format, &chroma_w, &chroma_h) 
== 0) {
+if (chroma_w == 1 && chroma_h == 1) {
+return (chroma_location == AVCHROMA_LOC_LEFT)
+   ? VPX_SUBSAMPLING_420_VERTICAL
+   : VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA;
+} else if (chroma_w == 1 && chroma_h == 0) {
+return VPX_SUBSAMPLING_422;
+} else if (chroma_w == 0 && chroma_h == 0) {
+return VPX_SUBSAMPLING_444;
+}
+}
+av_log(pb, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", pixel_format);
+return -1;
+}
+
+static int get_bit_depth(AVIOContext *pb, enum AVPixelFormat pixel_format)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pixel_format);
+if (desc == NULL) {
+av_log(pb, AV_LOG_ERROR, "Unsupported pixel format (%d)

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 6:13 PM, Ronald S. Bultje 
wrote:

> 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.
>

Correct. I don't want to limit it to vp9 only. I can use vpcc if Hendrik is
more comfortable with that.

>
>
> > > +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.
>

Ok, removed "!!".

>
> Ronald
> ___
> 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 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 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, tr

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

2016-06-15 Thread KongQun Yang
Please take a look at patchset v5. Thanks.

-- KongQun Yang (KQ)

On Tue, Jun 14, 2016 at 2:58 PM, Ronald S. Bultje 
wrote:

> 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).
>

Oops, missed this one. Thanks.

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


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

2016-06-15 Thread Kongqun Yang
== MODE_IPOD)
 mov_write_uuid_tag_ipod(pb);
+} else if (track->par->codec_id == AV_CODEC_ID_VP9) {
+mov_write_vpcc_tag(mov->fc, 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 > 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;
+}
+}
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 track->timescale = st->codecpar->sample_rate;
 if (!st->codecpar->frame_size && 
!av_get_bits_per_sample(st->codecpar->codec_id)) {
diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c
new file mode 100644
index 000..2390e17
--- /dev/null
+++ b/libavformat/vpcc.c
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 KongQun Yang (kqy...@google.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/pixfmt.h"
+#include "vpcc.h"
+
+enum VpxColorSpace
+{
+VPX_COLOR_SPACE_UNSPECIFIED = 0,
+VPX_COLOR_SPACE_BT601 = 1,
+VPX_COLOR_SPACE_BT709 = 2,
+VPX_COLOR_SPACE_SMPTE_170 = 3,
+VPX_COLOR_SPACE_SMPTE_240 = 4,
+VPX_COLOR_SPACE_BT2020_NCL = 5,
+VPX_COLOR_SPACE_BT2020_CL = 6,
+VPX_COLOR_SPACE_RGB = 7,
+};
+
+static int get_vpx_color_space(AVFormatContext *s,
+   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_UNSPECIFIED:
+return VPX_COLOR_SPACE_UNSPECIFIED;
+case AVCOL_SPC_BT470BG:
+return VPX_COLOR_SPACE_BT601;
+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:
+av_log(s, AV_LOG_ERROR, "Unsupported color space (%d)\n", color_space);
+return -1;
+}
+}
+
+enum VPX_CHROMA_SUBSAMPLING
+{
+VPX_SUBSAMPLING_420_VERTICAL = 0,
+VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA = 1,
+VPX_SUBSAMPLING_422 = 2,
+VPX_SUBSAMPLING_444 = 3,
+};
+
+static int get_vpx_chroma_subsampling(AVFormatContext *s,
+  enum AVPixelFormat pixel_format,
+  enum AVChromaLocation chroma_location)
+{
+int chroma_w, chroma_h;
+if (av_pix_fmt_get_chroma_sub_sample(pixel_format, &chroma_w, &chroma_h) 
== 0) {
+if (chroma_w == 1 && chroma_h == 1) {
+return (chroma_location == AVCHROMA_LOC_LEFT)
+   ? VPX_SUBSAMPLING_420_VERTICAL
+   : VPX_SUBSAMPLING_420_COLLOCATED_WITH_LUMA;
+} else if (chroma_w == 1 && chroma_h == 0) {
+return VPX_SUBSAMPLING_422;
+} else if (chroma_w == 0 && chroma_h == 0) {
+return VPX_SUBSAMPLING_444;
+}
+}
+av_log(s, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", pixel_format);
+return -1;
+}
+
+static int get_bit_depth(AVFormatContext *s, enum AVPixelFormat pixel_format)
+{
+const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pixel_

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

2016-06-15 Thread KongQun Yang
Thanks for the review, uploaded patch v7 with two changes:
1. Use AVFormatContext as the logging context
2. Renamed the file from vpc.c/vpc.h to vpcc.c/vpcc.h

Please take another look.

-- KongQun Yang (KQ)

On Tue, Jun 14, 2016 at 11:27 PM, Hendrik Leppkes 
wrote:

> On Wed, Jun 15, 2016 at 3:25 AM, KongQun Yang
>  wrote:
> > -- 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?
> >
>
> Thats an odd choice for logging.
> If there is no natural logging context, you should just add a "void*
> logctx" argument to the new function you introduced, its what is
> commonly done in other places. That way the mov muxer can then pass a
> reference to the AVFormatContext in there for more natural logging.
>
> - Hendrik
> ___
> 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 v6] Add experimental support for vp9 in iso-bmff

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

On Wed, Jun 15, 2016 at 5:00 AM, Carl Eugen Hoyos  wrote:

> Kongqun Yang  gmail.com> writes:
>
> > +} else if (chroma_w == 0 && chroma_h == 0) {
> > +return VPX_SUBSAMPLING_444;
>
> Could you confirm that this fixes RGB encoding?
> I believe this was broken in your previous patch.
>

Yes, RGB is now supported (chroma subsampling is VPX_SUBSAMPLING_444).

>
> 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] [PATCH v7] Add experimental support for vp9 in iso-bmff

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

On Wed, Jun 15, 2016 at 3:08 PM, Ronald S. Bultje 
wrote:

> Hi,
>
> On Wed, Jun 15, 2016 at 4:53 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
>>
>> '-strict -2' is required to use this feature.
>>
>> Change-Id: Iaa7ddf5524b17e8d79cd1923b26f096d6e91
>> ---
>>  libavformat/Makefile |   2 +-
>>  libavformat/isom.c   |   3 ++
>>  libavformat/movenc.c |  26 +
>>  libavformat/vpcc.c   | 148
>> +++
>>  libavformat/vpcc.h   |  47 
>>  5 files changed, 225 insertions(+), 1 deletion(-)
>>  create mode 100644 libavformat/vpcc.c
>>  create mode 100644 libavformat/vpcc.h
>
>
> No further comments from me, LGTM but I'd wait a day before push to give
> others a day to re-review also.
>

Sure, thanks for reviewing and all the helpful comments! Btw, are you going
to help commit the change?


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


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

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

On Fri, Jun 17, 2016 at 7:37 AM, Ronald S. Bultje 
wrote:

> Hi,
>
> On Thu, Jun 16, 2016 at 9:06 AM, Ronald S. Bultje 
> wrote:
>
>> Hi,
>>
>> On Wed, Jun 15, 2016 at 7:22 PM, KongQun Yang  wrote:
>>
>>>
>>>
>>> -- KongQun Yang (KQ)
>>>
>>> On Wed, Jun 15, 2016 at 3:08 PM, Ronald S. Bultje 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> On Wed, Jun 15, 2016 at 4:53 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
>>>>>
>>>>> '-strict -2' is required to use this feature.
>>>>>
>>>>> Change-Id: Iaa7ddf5524b17e8d79cd1923b26f096d6e91
>>>>> ---
>>>>>  libavformat/Makefile |   2 +-
>>>>>  libavformat/isom.c   |   3 ++
>>>>>  libavformat/movenc.c |  26 +
>>>>>  libavformat/vpcc.c   | 148
>>>>> +++
>>>>>  libavformat/vpcc.h   |  47 
>>>>>  5 files changed, 225 insertions(+), 1 deletion(-)
>>>>>  create mode 100644 libavformat/vpcc.c
>>>>>  create mode 100644 libavformat/vpcc.h
>>>>
>>>>
>>>> No further comments from me, LGTM but I'd wait a day before push to
>>>> give others a day to re-review also.
>>>>
>>>
>>> Sure, thanks for reviewing and all the helpful comments! Btw, are you
>>> going to help commit the change?
>>>
>>
>> Yes. (Poke me if I haven't by tomorrow.)
>>
>
> Pushed.
>

Cool. Thanks!

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


[FFmpeg-devel] [PATCH] Update mp4 object type for VP9

2017-06-28 Thread KongQun Yang
Updated to the standard value 0xB1 defined in mp4ra.org.

Change-Id: I6260fb11ce275f0da12b0c92ecf670bfde28b4e5
---
 libavformat/isom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/isom.c b/libavformat/isom.c
index 55221156f8..3a9b3baf96 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -60,7 +60,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
 { AV_CODEC_ID_EAC3, 0xA6 },
 { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
 { AV_CODEC_ID_OPUS, 0xAD }, /* mp4ra.org */
-{ AV_CODEC_ID_VP9 , 0xC0 }, /* nonstandard, update when there is a 
standard value */
+{ AV_CODEC_ID_VP9 , 0xB1 }, /* mp4ra.org */
 { AV_CODEC_ID_FLAC, 0xC1 }, /* nonstandard, update when there is a 
standard value */
 { AV_CODEC_ID_TSCC2   , 0xD0 }, /* nonstandard, camtasia uses it */
 { AV_CODEC_ID_EVRC, 0xD1 }, /* nonstandard, pvAuthor uses it */
-- 
2.13.2.725.g09c95d1e9-goog

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