Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-18 Thread Limin Wang
On Wed, Jul 17, 2019 at 10:53:08AM -0400, Vittorio Giovara wrote:
> On Tue, Jul 16, 2019 at 10:29 PM Limin Wang  wrote:
> 
> > On Tue, Jul 16, 2019 at 09:36:32PM -0400, Rick Kern wrote:
> > > Testing for the new transfer functions when compiling for OSX 10.12
> > reports
> > > the color settings as "yuv420p(tv, bt2020nc/bt2020/reserved)" in ffprobe.
> > > Is "reserved" (0) the expected default when the transfer function isn't
> > > supported?
> > mac 10.13 support:
> > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> > kCVImageBufferTransferFunction_ITU_R_2100_HLG
> >
> > OSX 10.14 support:
> > kCVImageBufferTransferFunction_Linear
> >
> > For 10.12, the HAVE_* macros should be detected as 0 if correct.
> >
> 
> 0 is a reserved value in the color specification and should be avoided if
> possible.
> Would it be possible to fallback on 2 (unknown) when these macros are not
> found?

OSX have defined it as string and no such string map to 2(unknown), so if we 
failed to get the map string, it'll set to NULL and we'll not set the 
interface. 
Or we should check the result and failed the init to avoid it.

but it's not related to the patch, without it, you should get the same result.


> -- 
> Vittorio
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-17 Thread Limin Wang
On Wed, Jul 17, 2019 at 10:53:08AM -0400, Vittorio Giovara wrote:
> On Tue, Jul 16, 2019 at 10:29 PM Limin Wang  wrote:
> 
> > On Tue, Jul 16, 2019 at 09:36:32PM -0400, Rick Kern wrote:
> > > Testing for the new transfer functions when compiling for OSX 10.12
> > reports
> > > the color settings as "yuv420p(tv, bt2020nc/bt2020/reserved)" in ffprobe.
> > > Is "reserved" (0) the expected default when the transfer function isn't
> > > supported?
> > mac 10.13 support:
> > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> > kCVImageBufferTransferFunction_ITU_R_2100_HLG
> >
> > OSX 10.14 support:
> > kCVImageBufferTransferFunction_Linear
> >
> > For 10.12, the HAVE_* macros should be detected as 0 if correct.
> >
> 
> 0 is a reserved value in the color specification and should be avoided if
> possible.
> Would it be possible to fallback on 2 (unknown) when these macros are not
> found?

My old mac pro don't support hevc, so I can test it. Please check the
HAVE* is 0

➜  ffmpeg.git git:(videotoolboxenc_v2) ✗ sw_vers -productVersion
10.11.6
➜  ffmpeg.git git:(videotoolboxenc_v2) ✗ grep "HAVE_KCV*" config.h
#define HAVE_KCMVIDEOCODECTYPE_HEVC 1
#define HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE 0
#define HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ 0
#define HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG 0
#define HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR 0

I have submited another patch to fix it, please try whether it's OK.

> -- 
> Vittorio
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-17 Thread Vittorio Giovara
On Tue, Jul 16, 2019 at 10:29 PM Limin Wang  wrote:

> On Tue, Jul 16, 2019 at 09:36:32PM -0400, Rick Kern wrote:
> > Testing for the new transfer functions when compiling for OSX 10.12
> reports
> > the color settings as "yuv420p(tv, bt2020nc/bt2020/reserved)" in ffprobe.
> > Is "reserved" (0) the expected default when the transfer function isn't
> > supported?
> mac 10.13 support:
> kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> kCVImageBufferTransferFunction_ITU_R_2100_HLG
>
> OSX 10.14 support:
> kCVImageBufferTransferFunction_Linear
>
> For 10.12, the HAVE_* macros should be detected as 0 if correct.
>

0 is a reserved value in the color specification and should be avoided if
possible.
Would it be possible to fallback on 2 (unknown) when these macros are not
found?
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-16 Thread Limin Wang
On Tue, Jul 16, 2019 at 09:36:32PM -0400, Rick Kern wrote:
> On Wed, Jul 10, 2019 at 5:29 AM Dennis Mungai  wrote:
> 
> > On Wed, Jul 10, 2019, 11:06 Hendrik Leppkes  wrote:
> >
> > > On Wed, Jul 10, 2019 at 4:23 AM Dennis Mungai  wrote:
> > > >
> > > > On Wed, Jul 10, 2019, 03:05 Aman Gupta  wrote:
> > > >
> > > > > On Wed, Jun 26, 2019 at 4:25 AM  wrote:
> > > > >
> > > > > > From: Limin Wang 
> > > > > >
> > > > > > Below is the testing ffmpeg command for the setting:
> > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > > > -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts
> > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > > > -colorspace bt2020_ncl -color_trc linear linear.ts
> > > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > > > -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts
> > > > > >
> > > > >
> > > > > Patch looks reasonable to me. Will commit in a few days if no one
> > else
> > > > > comments.
> > > > >
> > > > > Aman
> > > > >
> > > > >
> > > > > >
> > > > > > Signed-off-by: Limin Wang 
> > > > > > ---
> > > > > >  configure|  6 ++
> > > > > >  libavcodec/videotoolboxenc.c | 16 
> > > > > >  2 files changed, 22 insertions(+)
> > > > > >
> > > > > > diff --git a/configure b/configure
> > > > > > index 7cea9d4d73..0a5e940c0c 100755
> > > > > > --- a/configure
> > > > > > +++ b/configure
> > > > > > @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES="
> > > > > >  TYPES_LIST="
> > > > > >  kCMVideoCodecType_HEVC
> > > > > >  kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
> > > > > > +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> > > > > > +kCVImageBufferTransferFunction_ITU_R_2100_HLG
> > > > > > +kCVImageBufferTransferFunction_Linear
> > > > > >  socklen_t
> > > > > >  struct_addrinfo
> > > > > >  struct_group_source_req
> > > > > > @@ -6044,6 +6047,9 @@ enabled videotoolbox && {
> > > > > >  check_lib coreservices CoreServices/CoreServices.h
> > > > > > UTGetOSTypeFromString "-framework CoreServices"
> > > > > >  check_func_headers CoreMedia/CMFormatDescription.h
> > > > > > kCMVideoCodecType_HEVC "-framework CoreMedia"
> > > > > >  check_func_headers CoreVideo/CVPixelBuffer.h
> > > > > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework
> > > CoreVideo"
> > > > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework
> > > CoreVideo"
> > > > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework
> > CoreVideo"
> > > > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > > > kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
> > > > > >  }
> > > > > >
> > > > > >  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
> > > > > > diff --git a/libavcodec/videotoolboxenc.c
> > > b/libavcodec/videotoolboxenc.c
> > > > > > index f8ccdea52d..0dc6eb4cf4 100644
> > > > > > --- a/libavcodec/videotoolboxenc.c
> > > > > > +++ b/libavcodec/videotoolboxenc.c
> > > > > > @@ -915,6 +915,22 @@ static int
> > > get_cv_transfer_function(AVCodecContext
> > > > > > *avctx,
> > > > > >  *transfer_fnc =
> > > > > > kCVImageBufferTransferFunction_SMPTE_240M_1995;
> > > > > >  break;
> > > > > >
> > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
> > > > > > +case AVCOL_TRC_SMPTE2084:
> > > > > > +*transfer_fnc =
> > > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> > > > > > +break;
> > > > > > +#endif
> > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR
> > > > > > +case AVCOL_TRC_LINEAR:
> > > > > > +*transfer_fnc = kCVImageBufferTransferFunction_Linear;
> > > > > > +break;
> > > > > > +#endif
> > > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
> > > > > > +case AVCOL_TRC_ARIB_STD_B67:
> > > > > > +*transfer_fnc =
> > > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> > > > > > +break;
> > > > > > +#endif
> > > > > > +
> > > > > >  case AVCOL_TRC_GAMMA22:
> > > > > >  gamma = 2.2;
> > > > > >  *transfer_fnc =
> > kCVImageBufferTransferFunction_UseGamma;
> > > > > > --
> > > > > > 2.21.0
> > > > > >
> > > > > > ___
> > > > > > ffmpeg-devel mailing list
> > > > > > ffmpeg-devel@ffmpeg.org
> > > > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > > > >
> > > > > > To unsubscribe, visit link above, or email
> > > > > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > > > >
> > > >
> > > > A while back, a similar patch was rejected for NVENC (from the same
> > > author)
> > > > on the basis of such functionality not being suitably placed as an
> > > encoder
> > > > feature.

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-16 Thread Rick Kern
On Wed, Jul 10, 2019 at 5:29 AM Dennis Mungai  wrote:

> On Wed, Jul 10, 2019, 11:06 Hendrik Leppkes  wrote:
>
> > On Wed, Jul 10, 2019 at 4:23 AM Dennis Mungai  wrote:
> > >
> > > On Wed, Jul 10, 2019, 03:05 Aman Gupta  wrote:
> > >
> > > > On Wed, Jun 26, 2019 at 4:25 AM  wrote:
> > > >
> > > > > From: Limin Wang 
> > > > >
> > > > > Below is the testing ffmpeg command for the setting:
> > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > > -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts
> > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > > -colorspace bt2020_ncl -color_trc linear linear.ts
> > > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > > -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts
> > > > >
> > > >
> > > > Patch looks reasonable to me. Will commit in a few days if no one
> else
> > > > comments.
> > > >
> > > > Aman
> > > >
> > > >
> > > > >
> > > > > Signed-off-by: Limin Wang 
> > > > > ---
> > > > >  configure|  6 ++
> > > > >  libavcodec/videotoolboxenc.c | 16 
> > > > >  2 files changed, 22 insertions(+)
> > > > >
> > > > > diff --git a/configure b/configure
> > > > > index 7cea9d4d73..0a5e940c0c 100755
> > > > > --- a/configure
> > > > > +++ b/configure
> > > > > @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES="
> > > > >  TYPES_LIST="
> > > > >  kCMVideoCodecType_HEVC
> > > > >  kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
> > > > > +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> > > > > +kCVImageBufferTransferFunction_ITU_R_2100_HLG
> > > > > +kCVImageBufferTransferFunction_Linear
> > > > >  socklen_t
> > > > >  struct_addrinfo
> > > > >  struct_group_source_req
> > > > > @@ -6044,6 +6047,9 @@ enabled videotoolbox && {
> > > > >  check_lib coreservices CoreServices/CoreServices.h
> > > > > UTGetOSTypeFromString "-framework CoreServices"
> > > > >  check_func_headers CoreMedia/CMFormatDescription.h
> > > > > kCMVideoCodecType_HEVC "-framework CoreMedia"
> > > > >  check_func_headers CoreVideo/CVPixelBuffer.h
> > > > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework
> > CoreVideo"
> > > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework
> > CoreVideo"
> > > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework
> CoreVideo"
> > > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > > kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
> > > > >  }
> > > > >
> > > > >  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
> > > > > diff --git a/libavcodec/videotoolboxenc.c
> > b/libavcodec/videotoolboxenc.c
> > > > > index f8ccdea52d..0dc6eb4cf4 100644
> > > > > --- a/libavcodec/videotoolboxenc.c
> > > > > +++ b/libavcodec/videotoolboxenc.c
> > > > > @@ -915,6 +915,22 @@ static int
> > get_cv_transfer_function(AVCodecContext
> > > > > *avctx,
> > > > >  *transfer_fnc =
> > > > > kCVImageBufferTransferFunction_SMPTE_240M_1995;
> > > > >  break;
> > > > >
> > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
> > > > > +case AVCOL_TRC_SMPTE2084:
> > > > > +*transfer_fnc =
> > > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> > > > > +break;
> > > > > +#endif
> > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR
> > > > > +case AVCOL_TRC_LINEAR:
> > > > > +*transfer_fnc = kCVImageBufferTransferFunction_Linear;
> > > > > +break;
> > > > > +#endif
> > > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
> > > > > +case AVCOL_TRC_ARIB_STD_B67:
> > > > > +*transfer_fnc =
> > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> > > > > +break;
> > > > > +#endif
> > > > > +
> > > > >  case AVCOL_TRC_GAMMA22:
> > > > >  gamma = 2.2;
> > > > >  *transfer_fnc =
> kCVImageBufferTransferFunction_UseGamma;
> > > > > --
> > > > > 2.21.0
> > > > >
> > > > > ___
> > > > > ffmpeg-devel mailing list
> > > > > ffmpeg-devel@ffmpeg.org
> > > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > > >
> > > > > To unsubscribe, visit link above, or email
> > > > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > > >
> > >
> > > A while back, a similar patch was rejected for NVENC (from the same
> > author)
> > > on the basis of such functionality not being suitably placed as an
> > encoder
> > > feature.
> > >
> > > Looking back at other implementations, eg hevc_vaapi, the same is
> indeed
> > > allowed, where SEI metadata retention for HDR is present.
> > >
> > > To the OP: If the patch for NVENC were refactored in a manner similar
> to
> > > this, abstracting details such as master display info 

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-10 Thread Dennis Mungai
On Wed, Jul 10, 2019, 11:06 Hendrik Leppkes  wrote:

> On Wed, Jul 10, 2019 at 4:23 AM Dennis Mungai  wrote:
> >
> > On Wed, Jul 10, 2019, 03:05 Aman Gupta  wrote:
> >
> > > On Wed, Jun 26, 2019 at 4:25 AM  wrote:
> > >
> > > > From: Limin Wang 
> > > >
> > > > Below is the testing ffmpeg command for the setting:
> > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts
> > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > -colorspace bt2020_ncl -color_trc linear linear.ts
> > > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > > -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts
> > > >
> > >
> > > Patch looks reasonable to me. Will commit in a few days if no one else
> > > comments.
> > >
> > > Aman
> > >
> > >
> > > >
> > > > Signed-off-by: Limin Wang 
> > > > ---
> > > >  configure|  6 ++
> > > >  libavcodec/videotoolboxenc.c | 16 
> > > >  2 files changed, 22 insertions(+)
> > > >
> > > > diff --git a/configure b/configure
> > > > index 7cea9d4d73..0a5e940c0c 100755
> > > > --- a/configure
> > > > +++ b/configure
> > > > @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES="
> > > >  TYPES_LIST="
> > > >  kCMVideoCodecType_HEVC
> > > >  kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
> > > > +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> > > > +kCVImageBufferTransferFunction_ITU_R_2100_HLG
> > > > +kCVImageBufferTransferFunction_Linear
> > > >  socklen_t
> > > >  struct_addrinfo
> > > >  struct_group_source_req
> > > > @@ -6044,6 +6047,9 @@ enabled videotoolbox && {
> > > >  check_lib coreservices CoreServices/CoreServices.h
> > > > UTGetOSTypeFromString "-framework CoreServices"
> > > >  check_func_headers CoreMedia/CMFormatDescription.h
> > > > kCMVideoCodecType_HEVC "-framework CoreMedia"
> > > >  check_func_headers CoreVideo/CVPixelBuffer.h
> > > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework
> CoreVideo"
> > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework
> CoreVideo"
> > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
> > > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > > kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
> > > >  }
> > > >
> > > >  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
> > > > diff --git a/libavcodec/videotoolboxenc.c
> b/libavcodec/videotoolboxenc.c
> > > > index f8ccdea52d..0dc6eb4cf4 100644
> > > > --- a/libavcodec/videotoolboxenc.c
> > > > +++ b/libavcodec/videotoolboxenc.c
> > > > @@ -915,6 +915,22 @@ static int
> get_cv_transfer_function(AVCodecContext
> > > > *avctx,
> > > >  *transfer_fnc =
> > > > kCVImageBufferTransferFunction_SMPTE_240M_1995;
> > > >  break;
> > > >
> > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
> > > > +case AVCOL_TRC_SMPTE2084:
> > > > +*transfer_fnc =
> > > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> > > > +break;
> > > > +#endif
> > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR
> > > > +case AVCOL_TRC_LINEAR:
> > > > +*transfer_fnc = kCVImageBufferTransferFunction_Linear;
> > > > +break;
> > > > +#endif
> > > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
> > > > +case AVCOL_TRC_ARIB_STD_B67:
> > > > +*transfer_fnc =
> > > kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> > > > +break;
> > > > +#endif
> > > > +
> > > >  case AVCOL_TRC_GAMMA22:
> > > >  gamma = 2.2;
> > > >  *transfer_fnc = kCVImageBufferTransferFunction_UseGamma;
> > > > --
> > > > 2.21.0
> > > >
> > > > ___
> > > > ffmpeg-devel mailing list
> > > > ffmpeg-devel@ffmpeg.org
> > > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > >
> > > > To unsubscribe, visit link above, or email
> > > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > >
> >
> > A while back, a similar patch was rejected for NVENC (from the same
> author)
> > on the basis of such functionality not being suitably placed as an
> encoder
> > feature.
> >
> > Looking back at other implementations, eg hevc_vaapi, the same is indeed
> > allowed, where SEI metadata retention for HDR is present.
> >
> > To the OP: If the patch for NVENC were refactored in a manner similar to
> > this, abstracting details such as master display info for HDR (something
> > that was specifically flagged as not suitable as an encoder feature), it
> > might pass the patch review and be merged.
> >
> > Are there specific limitations (as implemented) that block such a feature
> > in NVENC? Perhaps the initial patch with mastering display controls for
> 

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-10 Thread Hendrik Leppkes
On Wed, Jul 10, 2019 at 4:23 AM Dennis Mungai  wrote:
>
> On Wed, Jul 10, 2019, 03:05 Aman Gupta  wrote:
>
> > On Wed, Jun 26, 2019 at 4:25 AM  wrote:
> >
> > > From: Limin Wang 
> > >
> > > Below is the testing ffmpeg command for the setting:
> > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts
> > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > -colorspace bt2020_ncl -color_trc linear linear.ts
> > > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > > -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts
> > >
> >
> > Patch looks reasonable to me. Will commit in a few days if no one else
> > comments.
> >
> > Aman
> >
> >
> > >
> > > Signed-off-by: Limin Wang 
> > > ---
> > >  configure|  6 ++
> > >  libavcodec/videotoolboxenc.c | 16 
> > >  2 files changed, 22 insertions(+)
> > >
> > > diff --git a/configure b/configure
> > > index 7cea9d4d73..0a5e940c0c 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES="
> > >  TYPES_LIST="
> > >  kCMVideoCodecType_HEVC
> > >  kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
> > > +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> > > +kCVImageBufferTransferFunction_ITU_R_2100_HLG
> > > +kCVImageBufferTransferFunction_Linear
> > >  socklen_t
> > >  struct_addrinfo
> > >  struct_group_source_req
> > > @@ -6044,6 +6047,9 @@ enabled videotoolbox && {
> > >  check_lib coreservices CoreServices/CoreServices.h
> > > UTGetOSTypeFromString "-framework CoreServices"
> > >  check_func_headers CoreMedia/CMFormatDescription.h
> > > kCMVideoCodecType_HEVC "-framework CoreMedia"
> > >  check_func_headers CoreVideo/CVPixelBuffer.h
> > > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
> > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
> > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
> > > +check_func_headers CoreVideo/CVImageBuffer.h
> > > kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
> > >  }
> > >
> > >  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
> > > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> > > index f8ccdea52d..0dc6eb4cf4 100644
> > > --- a/libavcodec/videotoolboxenc.c
> > > +++ b/libavcodec/videotoolboxenc.c
> > > @@ -915,6 +915,22 @@ static int get_cv_transfer_function(AVCodecContext
> > > *avctx,
> > >  *transfer_fnc =
> > > kCVImageBufferTransferFunction_SMPTE_240M_1995;
> > >  break;
> > >
> > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
> > > +case AVCOL_TRC_SMPTE2084:
> > > +*transfer_fnc =
> > > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> > > +break;
> > > +#endif
> > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR
> > > +case AVCOL_TRC_LINEAR:
> > > +*transfer_fnc = kCVImageBufferTransferFunction_Linear;
> > > +break;
> > > +#endif
> > > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
> > > +case AVCOL_TRC_ARIB_STD_B67:
> > > +*transfer_fnc =
> > kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> > > +break;
> > > +#endif
> > > +
> > >  case AVCOL_TRC_GAMMA22:
> > >  gamma = 2.2;
> > >  *transfer_fnc = kCVImageBufferTransferFunction_UseGamma;
> > > --
> > > 2.21.0
> > >
> > > ___
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > > To unsubscribe, visit link above, or email
> > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> >
>
> A while back, a similar patch was rejected for NVENC (from the same author)
> on the basis of such functionality not being suitably placed as an encoder
> feature.
>
> Looking back at other implementations, eg hevc_vaapi, the same is indeed
> allowed, where SEI metadata retention for HDR is present.
>
> To the OP: If the patch for NVENC were refactored in a manner similar to
> this, abstracting details such as master display info for HDR (something
> that was specifically flagged as not suitable as an encoder feature), it
> might pass the patch review and be merged.
>
> Are there specific limitations (as implemented) that block such a feature
> in NVENC? Perhaps the initial patch with mastering display controls for HDR
> was written that way to circumvent such a limitation.
>

I think you are confusing the type of patches here. This does nothing
but extend existing functionality to forward a few more values in
basically an enum that was already being set.
The other patch was about parsing user inputs and 

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-09 Thread Dennis Mungai
On Wed, Jul 10, 2019, 03:05 Aman Gupta  wrote:

> On Wed, Jun 26, 2019 at 4:25 AM  wrote:
>
> > From: Limin Wang 
> >
> > Below is the testing ffmpeg command for the setting:
> > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts
> > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > -colorspace bt2020_ncl -color_trc linear linear.ts
> > ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> > -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts
> >
>
> Patch looks reasonable to me. Will commit in a few days if no one else
> comments.
>
> Aman
>
>
> >
> > Signed-off-by: Limin Wang 
> > ---
> >  configure|  6 ++
> >  libavcodec/videotoolboxenc.c | 16 
> >  2 files changed, 22 insertions(+)
> >
> > diff --git a/configure b/configure
> > index 7cea9d4d73..0a5e940c0c 100755
> > --- a/configure
> > +++ b/configure
> > @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES="
> >  TYPES_LIST="
> >  kCMVideoCodecType_HEVC
> >  kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
> > +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> > +kCVImageBufferTransferFunction_ITU_R_2100_HLG
> > +kCVImageBufferTransferFunction_Linear
> >  socklen_t
> >  struct_addrinfo
> >  struct_group_source_req
> > @@ -6044,6 +6047,9 @@ enabled videotoolbox && {
> >  check_lib coreservices CoreServices/CoreServices.h
> > UTGetOSTypeFromString "-framework CoreServices"
> >  check_func_headers CoreMedia/CMFormatDescription.h
> > kCMVideoCodecType_HEVC "-framework CoreMedia"
> >  check_func_headers CoreVideo/CVPixelBuffer.h
> > kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
> > +check_func_headers CoreVideo/CVImageBuffer.h
> > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
> > +check_func_headers CoreVideo/CVImageBuffer.h
> > kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
> > +check_func_headers CoreVideo/CVImageBuffer.h
> > kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
> >  }
> >
> >  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
> > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> > index f8ccdea52d..0dc6eb4cf4 100644
> > --- a/libavcodec/videotoolboxenc.c
> > +++ b/libavcodec/videotoolboxenc.c
> > @@ -915,6 +915,22 @@ static int get_cv_transfer_function(AVCodecContext
> > *avctx,
> >  *transfer_fnc =
> > kCVImageBufferTransferFunction_SMPTE_240M_1995;
> >  break;
> >
> > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
> > +case AVCOL_TRC_SMPTE2084:
> > +*transfer_fnc =
> > kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> > +break;
> > +#endif
> > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR
> > +case AVCOL_TRC_LINEAR:
> > +*transfer_fnc = kCVImageBufferTransferFunction_Linear;
> > +break;
> > +#endif
> > +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
> > +case AVCOL_TRC_ARIB_STD_B67:
> > +*transfer_fnc =
> kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> > +break;
> > +#endif
> > +
> >  case AVCOL_TRC_GAMMA22:
> >  gamma = 2.2;
> >  *transfer_fnc = kCVImageBufferTransferFunction_UseGamma;
> > --
> > 2.21.0
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>

A while back, a similar patch was rejected for NVENC (from the same author)
on the basis of such functionality not being suitably placed as an encoder
feature.

Looking back at other implementations, eg hevc_vaapi, the same is indeed
allowed, where SEI metadata retention for HDR is present.

To the OP: If the patch for NVENC were refactored in a manner similar to
this, abstracting details such as master display info for HDR (something
that was specifically flagged as not suitable as an encoder feature), it
might pass the patch review and be merged.

Are there specific limitations (as implemented) that block such a feature
in NVENC? Perhaps the initial patch with mastering display controls for HDR
was written that way to circumvent such a limitation.

Regards,

Dennis

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-09 Thread Aman Gupta
On Wed, Jun 26, 2019 at 4:25 AM  wrote:

> From: Limin Wang 
>
> Below is the testing ffmpeg command for the setting:
> ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts
> ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> -colorspace bt2020_ncl -color_trc linear linear.ts
> ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020
> -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts
>

Patch looks reasonable to me. Will commit in a few days if no one else
comments.

Aman


>
> Signed-off-by: Limin Wang 
> ---
>  configure|  6 ++
>  libavcodec/videotoolboxenc.c | 16 
>  2 files changed, 22 insertions(+)
>
> diff --git a/configure b/configure
> index 7cea9d4d73..0a5e940c0c 100755
> --- a/configure
> +++ b/configure
> @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES="
>  TYPES_LIST="
>  kCMVideoCodecType_HEVC
>  kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
> +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> +kCVImageBufferTransferFunction_ITU_R_2100_HLG
> +kCVImageBufferTransferFunction_Linear
>  socklen_t
>  struct_addrinfo
>  struct_group_source_req
> @@ -6044,6 +6047,9 @@ enabled videotoolbox && {
>  check_lib coreservices CoreServices/CoreServices.h
> UTGetOSTypeFromString "-framework CoreServices"
>  check_func_headers CoreMedia/CMFormatDescription.h
> kCMVideoCodecType_HEVC "-framework CoreMedia"
>  check_func_headers CoreVideo/CVPixelBuffer.h
> kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
> +check_func_headers CoreVideo/CVImageBuffer.h
> kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
> +check_func_headers CoreVideo/CVImageBuffer.h
> kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
> +check_func_headers CoreVideo/CVImageBuffer.h
> kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
>  }
>
>  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index f8ccdea52d..0dc6eb4cf4 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -915,6 +915,22 @@ static int get_cv_transfer_function(AVCodecContext
> *avctx,
>  *transfer_fnc =
> kCVImageBufferTransferFunction_SMPTE_240M_1995;
>  break;
>
> +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
> +case AVCOL_TRC_SMPTE2084:
> +*transfer_fnc =
> kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> +break;
> +#endif
> +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR
> +case AVCOL_TRC_LINEAR:
> +*transfer_fnc = kCVImageBufferTransferFunction_Linear;
> +break;
> +#endif
> +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
> +case AVCOL_TRC_ARIB_STD_B67:
> +*transfer_fnc = kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> +break;
> +#endif
> +
>  case AVCOL_TRC_GAMMA22:
>  gamma = 2.2;
>  *transfer_fnc = kCVImageBufferTransferFunction_UseGamma;
> --
> 2.21.0
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: add hdr10, linear, hlg color transfer function for videotoolboxenc

2019-07-08 Thread Limin Wang

Richard Kern, please help to review the patch.

On Wed, Jun 26, 2019 at 06:57:59PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Below is the testing ffmpeg command for the setting:
> ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 
> -colorspace bt2020_ncl -color_trc smpte2084 smpte2048.ts
> ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 
> -colorspace bt2020_ncl -color_trc linear linear.ts
> ./ffmpeg -i input.ts -c:v hevc_videotoolbox -color_primaries bt2020 
> -colorspace bt2020_ncl -color_trc arib-std-b67 hlg.ts
> 
> Signed-off-by: Limin Wang 
> ---
>  configure|  6 ++
>  libavcodec/videotoolboxenc.c | 16 
>  2 files changed, 22 insertions(+)
> 
> diff --git a/configure b/configure
> index 7cea9d4d73..0a5e940c0c 100755
> --- a/configure
> +++ b/configure
> @@ -2260,6 +2260,9 @@ TOOLCHAIN_FEATURES="
>  TYPES_LIST="
>  kCMVideoCodecType_HEVC
>  kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
> +kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
> +kCVImageBufferTransferFunction_ITU_R_2100_HLG
> +kCVImageBufferTransferFunction_Linear
>  socklen_t
>  struct_addrinfo
>  struct_group_source_req
> @@ -6044,6 +6047,9 @@ enabled videotoolbox && {
>  check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString 
> "-framework CoreServices"
>  check_func_headers CoreMedia/CMFormatDescription.h 
> kCMVideoCodecType_HEVC "-framework CoreMedia"
>  check_func_headers CoreVideo/CVPixelBuffer.h 
> kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
> +check_func_headers CoreVideo/CVImageBuffer.h 
> kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
> +check_func_headers CoreVideo/CVImageBuffer.h 
> kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
> +check_func_headers CoreVideo/CVImageBuffer.h 
> kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
>  }
>  
>  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index f8ccdea52d..0dc6eb4cf4 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -915,6 +915,22 @@ static int get_cv_transfer_function(AVCodecContext 
> *avctx,
>  *transfer_fnc = kCVImageBufferTransferFunction_SMPTE_240M_1995;
>  break;
>  
> +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SMPTE_ST_2084_PQ
> +case AVCOL_TRC_SMPTE2084:
> +*transfer_fnc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> +break;
> +#endif
> +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_LINEAR
> +case AVCOL_TRC_LINEAR:
> +*transfer_fnc = kCVImageBufferTransferFunction_Linear;
> +break;
> +#endif
> +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG
> +case AVCOL_TRC_ARIB_STD_B67:
> +*transfer_fnc = kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> +break;
> +#endif
> +
>  case AVCOL_TRC_GAMMA22:
>  gamma = 2.2;
>  *transfer_fnc = kCVImageBufferTransferFunction_UseGamma;
> -- 
> 2.21.0
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".