diff mbox series

[FFmpeg-devel,v2,2/7] lavutil: add dolby vision related header

Message ID 1586612703-6862-3-git-send-email-mypopydev@gmail.com
State Superseded
Headers show
Series Support Dolby Vision | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Jun Zhao April 11, 2020, 1:44 p.m. UTC
From: vacinfang <vacinfang@tencent.com>

add dolby vision related header

Signed-off-by: vacinfang <vacinfang@tencent.com>
---
 libavutil/Makefile            |  1 +
 libavutil/dolby_vision_meta.h | 58 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 libavutil/dolby_vision_meta.h

Comments

Jean-Baptiste Kempf April 11, 2020, 2:17 p.m. UTC | #1
I really do not think it is a good idea to have a header with the name dolby in it.

On Sat, Apr 11, 2020, at 15:44, Jun Zhao wrote:
> From: vacinfang <vacinfang@tencent.com>
> 
> add dolby vision related header
> 
> Signed-off-by: vacinfang <vacinfang@tencent.com>
> ---
>  libavutil/Makefile            |  1 +
>  libavutil/dolby_vision_meta.h | 58 +++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 59 insertions(+)
>  create mode 100644 libavutil/dolby_vision_meta.h
> 
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index 8feb029..9204925 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -23,6 +23,7 @@ HEADERS = adler32.h                                   
>                   \
>            des.h                                                        
>  \
>            dict.h                                                       
>  \
>            display.h                                                    
>  \
> +          dolby_vision_meta.h                                          
>  \
>            downmix_info.h                                               
>  \
>            encryption_info.h                                            
>  \
>            error.h                                                      
>  \
> diff --git a/libavutil/dolby_vision_meta.h 
> b/libavutil/dolby_vision_meta.h
> new file mode 100644
> index 0000000..3fc2cad
> --- /dev/null
> +++ b/libavutil/dolby_vision_meta.h
> @@ -0,0 +1,58 @@
> +/*
> + * Copyright (c) 2020 Vacing Fang <vacingfang@tencent.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
> + */
> +
> +/**
> + * @file
> + * dolby vison configuration
> + */
> +
> +
> +#ifndef AVUTIL_DOLBY_VISION_META_H
> +#define AVUTIL_DOLBY_VISION_META_H
> +
> +#include <stdint.h>
> +
> +/*
> + * dolby vison configuration
> + * ref: 
> dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2
> +        
> dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2
> + * @code
> + * uint8_t  dv_version_major, the major version number that the stream 
> complies with
> + * uint8_t  dv_version_minor, the minor version number that the stream 
> complies with
> + * uint8_t  dv_profile, the Dolby Vision profile
> + * uint8_t  dv_level, the Dolby Vision level
> + * uint8_t  rpu_present_flag
> + * uint8_t  el_present_flag
> + * uint8_t  bl_present_flag
> + * uint8_t  dv_bl_signal_compatibility_id
> + * @endcode
> + */
> +typedef struct {
> +    uint8_t dv_version_major;
> +    uint8_t dv_version_minor;
> +    uint8_t dv_profile;
> +    uint8_t dv_level;
> +    uint8_t rpu_present_flag;
> +    uint8_t el_present_flag;
> +    uint8_t bl_present_flag;
> +    uint8_t dv_bl_signal_compatibility_id;
> +} AVDOVIDecoderConfigurationRecord;
> +
> +#endif /* AVUTIL_DOLBY_VISION_META_H */
> -- 
> 2.7.4
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Carl Eugen Hoyos April 11, 2020, 2:49 p.m. UTC | #2
Am Sa., 11. Apr. 2020 um 16:08 Uhr schrieb Jun Zhao <mypopydev@gmail.com>:
>
> From: vacinfang <vacinfang@tencent.com>
>
> add dolby vision related header

Apart from the name of the header file:
Could you explain why it is needed?

Is the Dolby Vision metadata not a black box that libavformat
has to provide to interested decoders?

Carl Eugen
Jan Ekström April 11, 2020, 3:01 p.m. UTC | #3
On Sat, Apr 11, 2020 at 5:49 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
> Am Sa., 11. Apr. 2020 um 16:08 Uhr schrieb Jun Zhao <mypopydev@gmail.com>:
> >
> > From: vacinfang <vacinfang@tencent.com>
> >
> > add dolby vision related header
>
> Apart from the name of the header file:
> Could you explain why it is needed?
>
> Is the Dolby Vision metadata not a black box that libavformat
> has to provide to interested decoders?
>

There's usually two different things:

1. Metadata in the file confirming that this is indeed DoVi. This is
what is being parsed. Otherwise the player application has no idea how
to handle DoVi (many of the profiles are actually just re-brands of
already standardized setups, while profiles 5 and I think 7 are the
more interesting ones).
2. The kind of "black box" (RPU) metadata within NAL units 62. That is
then what (for now) would be passed to a special metadata reader to
enable correct rendering of f.ex. profile 5 clips.

This patch set enables noting whether a file has the general metadata
from 1. I have seen implementations of 2. around, and we might have a
patch set for it at some point in the near future as we already have
open source code to render the DoVi data w/o the dynamic metadata of
those NAL unit 62 entries (see
https://code.videolan.org/videolan/libplacebo/-/commit/f850fa2839f9b679092e721068a57b0404608bdc
).

So to reiterate:
- The container metadata lets a player figure out if the AVStream is
flagged as DoVi and in which profile/level/does it have base|extension
layer contained within it.
- The NAL unit 62 metadata (RPUs) then enable correct rendering in
case of a profile that is not backwards compatible with standard color
spaces.

Best regards,
Jan
mypopy@gmail.com April 12, 2020, 1:22 a.m. UTC | #4
On Sat, Apr 11, 2020 at 10:18 PM Jean-Baptiste Kempf <jb@videolan.org> wrote:
>
> I really do not think it is a good idea to have a header with the name dolby in it.
>
Can you give some details, I don't why is a bad idea.
> On Sat, Apr 11, 2020, at 15:44, Jun Zhao wrote:
> > From: vacinfang <vacinfang@tencent.com>
> >
> > add dolby vision related header
> >
> > Signed-off-by: vacinfang <vacinfang@tencent.com>
> > ---
> >  libavutil/Makefile            |  1 +
> >  libavutil/dolby_vision_meta.h | 58 +++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 59 insertions(+)
> >  create mode 100644 libavutil/dolby_vision_meta.h
> >
> > diff --git a/libavutil/Makefile b/libavutil/Makefile
> > index 8feb029..9204925 100644
> > --- a/libavutil/Makefile
> > +++ b/libavutil/Makefile
> > @@ -23,6 +23,7 @@ HEADERS = adler32.h
> >                   \
> >            des.h
> >  \
> >            dict.h
> >  \
> >            display.h
> >  \
> > +          dolby_vision_meta.h
> >  \
> >            downmix_info.h
> >  \
> >            encryption_info.h
> >  \
> >            error.h
> >  \
> > diff --git a/libavutil/dolby_vision_meta.h
> > b/libavutil/dolby_vision_meta.h
> > new file mode 100644
> > index 0000000..3fc2cad
> > --- /dev/null
> > +++ b/libavutil/dolby_vision_meta.h
> > @@ -0,0 +1,58 @@
> > +/*
> > + * Copyright (c) 2020 Vacing Fang <vacingfang@tencent.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
> > + */
> > +
> > +/**
> > + * @file
> > + * dolby vison configuration
> > + */
> > +
> > +
> > +#ifndef AVUTIL_DOLBY_VISION_META_H
> > +#define AVUTIL_DOLBY_VISION_META_H
> > +
> > +#include <stdint.h>
> > +
> > +/*
> > + * dolby vison configuration
> > + * ref:
> > dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2
> > +
> > dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2
> > + * @code
> > + * uint8_t  dv_version_major, the major version number that the stream
> > complies with
> > + * uint8_t  dv_version_minor, the minor version number that the stream
> > complies with
> > + * uint8_t  dv_profile, the Dolby Vision profile
> > + * uint8_t  dv_level, the Dolby Vision level
> > + * uint8_t  rpu_present_flag
> > + * uint8_t  el_present_flag
> > + * uint8_t  bl_present_flag
> > + * uint8_t  dv_bl_signal_compatibility_id
> > + * @endcode
> > + */
> > +typedef struct {
> > +    uint8_t dv_version_major;
> > +    uint8_t dv_version_minor;
> > +    uint8_t dv_profile;
> > +    uint8_t dv_level;
> > +    uint8_t rpu_present_flag;
> > +    uint8_t el_present_flag;
> > +    uint8_t bl_present_flag;
> > +    uint8_t dv_bl_signal_compatibility_id;
> > +} AVDOVIDecoderConfigurationRecord;
> > +
> > +#endif /* AVUTIL_DOLBY_VISION_META_H */
> > --
mypopy@gmail.com April 12, 2020, 1:30 a.m. UTC | #5
On Sat, Apr 11, 2020 at 11:01 PM Jan Ekström <jeebjp@gmail.com> wrote:
>
> On Sat, Apr 11, 2020 at 5:49 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> >
> > Am Sa., 11. Apr. 2020 um 16:08 Uhr schrieb Jun Zhao <mypopydev@gmail.com>:
> > >
> > > From: vacinfang <vacinfang@tencent.com>
> > >
> > > add dolby vision related header
> >
> > Apart from the name of the header file:
> > Could you explain why it is needed?
> >
> > Is the Dolby Vision metadata not a black box that libavformat
> > has to provide to interested decoders?
> >
>
> There's usually two different things:
>
> 1. Metadata in the file confirming that this is indeed DoVi. This is
> what is being parsed. Otherwise the player application has no idea how
> to handle DoVi (many of the profiles are actually just re-brands of
> already standardized setups, while profiles 5 and I think 7 are the
> more interesting ones).
> 2. The kind of "black box" (RPU) metadata within NAL units 62. That is
> then what (for now) would be passed to a special metadata reader to
> enable correct rendering of f.ex. profile 5 clips.
>
> This patch set enables noting whether a file has the general metadata
> from 1. I have seen implementations of 2. around, and we might have a
> patch set for it at some point in the near future as we already have
> open source code to render the DoVi data w/o the dynamic metadata of
> those NAL unit 62 entries (see
> https://code.videolan.org/videolan/libplacebo/-/commit/f850fa2839f9b679092e721068a57b0404608bdc
> ).
>
> So to reiterate:
> - The container metadata lets a player figure out if the AVStream is
> flagged as DoVi and in which profile/level/does it have base|extension
> layer contained within it.
> - The NAL unit 62 metadata (RPUs) then enable correct rendering in
> case of a profile that is not backwards compatible with standard color
> spaces.
>
> Best regards,
> Jan
Yes, you are right, and thanks given a great details too, in our case,
we used FFmpeg libavformat for Dolby Vision MPEG TS/MP4 demuxing,
libavformat will parse the profile/level from MPEG TS/MP4 for other decoder (
the decoder is not part of FFmpeg)
Jean-Baptiste Kempf April 12, 2020, 1:05 p.m. UTC | #6
On Sun, Apr 12, 2020, at 03:22, mypopy@gmail.com wrote:
> On Sat, Apr 11, 2020 at 10:18 PM Jean-Baptiste Kempf <jb@videolan.org> wrote:
> >
> > I really do not think it is a good idea to have a header with the name dolby in it.
> >
> Can you give some details, I don't why is a bad idea.

Dolby is a trademark.
mypopy@gmail.com April 12, 2020, 1:12 p.m. UTC | #7
On Sun, Apr 12, 2020 at 9:06 PM Jean-Baptiste Kempf <jb@videolan.org> wrote:
>
>
>
> On Sun, Apr 12, 2020, at 03:22, mypopy@gmail.com wrote:
> > On Sat, Apr 11, 2020 at 10:18 PM Jean-Baptiste Kempf <jb@videolan.org> wrote:
> > >
> > > I really do not think it is a good idea to have a header with the name dolby in it.
> > >
> > Can you give some details, I don't why is a bad idea.
>
> Dolby is a trademark.
I see, will rename the file, tks the comments
>
diff mbox series

Patch

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 8feb029..9204925 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -23,6 +23,7 @@  HEADERS = adler32.h                                                     \
           des.h                                                         \
           dict.h                                                        \
           display.h                                                     \
+          dolby_vision_meta.h                                           \
           downmix_info.h                                                \
           encryption_info.h                                             \
           error.h                                                       \
diff --git a/libavutil/dolby_vision_meta.h b/libavutil/dolby_vision_meta.h
new file mode 100644
index 0000000..3fc2cad
--- /dev/null
+++ b/libavutil/dolby_vision_meta.h
@@ -0,0 +1,58 @@ 
+/*
+ * Copyright (c) 2020 Vacing Fang <vacingfang@tencent.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
+ */
+
+/**
+ * @file
+ * dolby vison configuration
+ */
+
+
+#ifndef AVUTIL_DOLBY_VISION_META_H
+#define AVUTIL_DOLBY_VISION_META_H
+
+#include <stdint.h>
+
+/*
+ * dolby vison configuration
+ * ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2
+        dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2
+ * @code
+ * uint8_t  dv_version_major, the major version number that the stream complies with
+ * uint8_t  dv_version_minor, the minor version number that the stream complies with
+ * uint8_t  dv_profile, the Dolby Vision profile
+ * uint8_t  dv_level, the Dolby Vision level
+ * uint8_t  rpu_present_flag
+ * uint8_t  el_present_flag
+ * uint8_t  bl_present_flag
+ * uint8_t  dv_bl_signal_compatibility_id
+ * @endcode
+ */
+typedef struct {
+    uint8_t dv_version_major;
+    uint8_t dv_version_minor;
+    uint8_t dv_profile;
+    uint8_t dv_level;
+    uint8_t rpu_present_flag;
+    uint8_t el_present_flag;
+    uint8_t bl_present_flag;
+    uint8_t dv_bl_signal_compatibility_id;
+} AVDOVIDecoderConfigurationRecord;
+
+#endif /* AVUTIL_DOLBY_VISION_META_H */