Re: [FFmpeg-devel] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information

2022-01-13 Thread lance . lmwang
On Thu, Jan 13, 2022 at 11:35:32PM +0200, Martin Storsjö wrote:
> On Thu, 13 Jan 2022, lance.lmw...@gmail.com wrote:
> 
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > libavcodec/libopenh264enc.c | 15 +++
> > 1 file changed, 15 insertions(+)
> > 
> > diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> > index de4b85c..a55bef8 100644
> > --- a/libavcodec/libopenh264enc.c
> > +++ b/libavcodec/libopenh264enc.c
> > @@ -330,6 +330,21 @@ static av_cold int svc_encode_init(AVCodecContext 
> > *avctx)
> > }
> > }
> > 
> > +#if OPENH264_VER_AT_LEAST(1, 6)
> > +param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
> > +param.sSpatialLayers[0].bVideoSignalTypePresent = true;
> 
> What does this flag do, and why do we set it unconditionally while we didn't
> use to before?
> 

OK, will update and set the flag only if bFullRange is set.

> > +if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
> > +param.sSpatialLayers[0].bFullRange = (avctx->color_range == 
> > AVCOL_RANGE_JPEG);
> > +
> > +param.sSpatialLayers[0].bColorDescriptionPresent = true;
> 
> Ditto - what does this do and why do we set it even if we wouldn't set any
> of the other fields?

will update and set the flag only if any the following fields are set.

> 
> // Martin
> 

-- 
Thanks,
Limin Wang
___
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 1/3] avcodec/libopenh264enc: support for colorspace and range information

2022-01-13 Thread Martin Storsjö

On Thu, 13 Jan 2022, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Signed-off-by: Limin Wang 
---
libavcodec/libopenh264enc.c | 15 +++
1 file changed, 15 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index de4b85c..a55bef8 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -330,6 +330,21 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
}
}

+#if OPENH264_VER_AT_LEAST(1, 6)
+param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
+param.sSpatialLayers[0].bVideoSignalTypePresent = true;


What does this flag do, and why do we set it unconditionally while we 
didn't use to before?



+if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
+param.sSpatialLayers[0].bFullRange = (avctx->color_range == 
AVCOL_RANGE_JPEG);
+
+param.sSpatialLayers[0].bColorDescriptionPresent = true;


Ditto - what does this do and why do we set it even if we wouldn't set any 
of the other fields?


// Martin

___
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] [PATCH 1/3] avcodec/libopenh264enc: support for colorspace and range information

2022-01-13 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavcodec/libopenh264enc.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index de4b85c..a55bef8 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -330,6 +330,21 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 }
 }
 
+#if OPENH264_VER_AT_LEAST(1, 6)
+param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF;
+param.sSpatialLayers[0].bVideoSignalTypePresent = true;
+if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED)
+param.sSpatialLayers[0].bFullRange = (avctx->color_range == 
AVCOL_RANGE_JPEG);
+
+param.sSpatialLayers[0].bColorDescriptionPresent = true;
+if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)
+param.sSpatialLayers[0].uiColorMatrix = avctx->colorspace;
+if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
+param.sSpatialLayers[0].uiColorPrimaries = avctx->color_primaries;
+if (avctx->color_trc != AVCOL_TRC_UNSPECIFIED)
+param.sSpatialLayers[0].uiTransferCharacteristics = avctx->color_trc;
+#endif
+
 if ((*s->encoder)->InitializeExt(s->encoder, ) != cmResultSuccess) {
 av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
 return AVERROR_UNKNOWN;
-- 
1.8.3.1

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