Message ID | 1642070709-3104-1-git-send-email-lance.lmwang@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/3] avcodec/libopenh264enc: support for colorspace and range information | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote: > From: Limin Wang <lance.lmwang@gmail.com> > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > 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
On Thu, Jan 13, 2022 at 11:35:32PM +0200, Martin Storsjö wrote: > On Thu, 13 Jan 2022, lance.lmwang@gmail.com wrote: > > > From: Limin Wang <lance.lmwang@gmail.com> > > > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > > --- > > 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 >
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, ¶m) != cmResultSuccess) { av_log(avctx, AV_LOG_ERROR, "Initialize failed\n"); return AVERROR_UNKNOWN;