[FFmpeg-devel] [PATCH] HDR Transcode VUI Info Copy

Michael Niedermayer michael at niedermayer.cc
Tue Apr 4 18:31:25 EEST 2017


On Tue, Apr 04, 2017 at 05:14:30PM +0200, wm4 wrote:
> On Tue, 4 Apr 2017 17:01:15 +0200
> Michael Niedermayer <michael at niedermayer.cc> wrote:
> 
> > On Mon, Apr 03, 2017 at 07:50:07PM +0000, Ben Chang wrote:
> > > Hi,
> > > 
> > > This patch adds copy of HDR  VUI info from decode ctx to encode ctx. Currently, information under colour_description_present_flag (eg. colour primaries, transfer_characteristics, matrix_coeffs) do not get copied to output stream when trancode happens.
> > > 
> > > Testing performed:
> > > ffmpeg.exe -y -hwaccel cuvid -vcodec hevc_cuvid -i input.h265 -vcodec hevc_nvenc output.h265
> > > Ensure the output bitstream contains the same colour_description_present_flag fields as input.
> > > 
> > > Also attaching previous discussion on this subject.
> > > 
> > > Thanks,
> > > Ben
> > > 
> > > -----------------------------------------------------------------------------------
> > > This email message is for the sole use of the intended recipient(s) and may contain
> > > confidential information.  Any unauthorized review, use, disclosure or distribution
> > > is prohibited.  If you are not the intended recipient, please contact the sender by
> > > reply email and destroy all copies of the original message.
> > > -----------------------------------------------------------------------------------  
> > 
> > >  ffmpeg.c |    3 +++
> > >  1 file changed, 3 insertions(+)
> > > 8a8befe4fc47b7279b15d655e39b12ca36be4bc2  HDR_transcode_VUI_copy.patch
> > > From c8092bc538ba7ae32357ca166e67809eb3705f60 Mon Sep 17 00:00:00 2001
> > > From: Ben Chang <benc at nvidia.com>
> > > Date: Mon, 27 Mar 2017 17:00:19 -0700
> > > Subject: [PATCH] Allow transfer of HDR-required VUI info from dec ctx to enc
> > >  ctx
> > > 
> > > ---
> > >  ffmpeg.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > index 532db80..1ef2906 100644
> > > --- a/ffmpeg.c
> > > +++ b/ffmpeg.c
> > > @@ -3239,6 +3239,9 @@ static int init_output_stream_encode(OutputStream *ost)
> > >          dec_ctx = ist->dec_ctx;
> > >  
> > >          enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location;
> > > +        enc_ctx->color_primaries = dec_ctx->color_primaries;
> > > +        enc_ctx->color_trc = dec_ctx->color_trc;
> > > +        enc_ctx->colorspace = dec_ctx->colorspace;  
> > 
> > These should at a minimum check the encoder and decoder use the same
> > pixel format, otherwise these details are more likley wrong than right
> > if they arent passed through avfilter in some form
> 
> The pixel format is entirely meaningless here.

yuv444 with chroma_sample_location from yuv420 ?
color_primaries with grayscale ?
AVColorTransferCharacteristic speific to 10/12/14 bit with yuv420 for encoding in a spec predating >8bit ?
AVCOL_SPC_RGB with yuv422 ?
AVCOL_SPC_YCOCG with rgb

i maintain my oppinion, if the pixel format differs, these variables
should not be blindly copied.
Its quite likely that with differing pixel format
the format has been converted to the target requirements and
the source fields no longer apply

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170404/4f0ca45b/attachment.sig>


More information about the ffmpeg-devel mailing list