Message ID | 1642150837-22960-1-git-send-email-lance.lmwang@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v2,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 |
andriy/make_aarch64_jetson | success | Make finished |
andriy/make_fate_aarch64_jetson | success | Make fate finished |
andriy/makeaarch64_jetson | warning | New warnings during build |
On Fri, 14 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 | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c > index de4b85c..5b5914c 100644 > --- a/libavcodec/libopenh264enc.c > +++ b/libavcodec/libopenh264enc.c > @@ -330,6 +330,28 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) > } > } > > +#if OPENH264_VER_AT_LEAST(1, 6) > + param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF; > + if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) { > + param.sSpatialLayers[0].bVideoSignalTypePresent = true; > + param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG); > + } > + > + if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED || > + avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || > + avctx->color_trc != AVCOL_TRC_UNSPECIFIED) { > + param.sSpatialLayers[0].bVideoSignalTypePresent = true; > + 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 Thanks, this looks correct to me. // Martin
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index de4b85c..5b5914c 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -330,6 +330,28 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) } } +#if OPENH264_VER_AT_LEAST(1, 6) + param.sSpatialLayers[0].uiVideoFormat = VF_UNDEF; + if (avctx->color_range != AVCOL_RANGE_UNSPECIFIED) { + param.sSpatialLayers[0].bVideoSignalTypePresent = true; + param.sSpatialLayers[0].bFullRange = (avctx->color_range == AVCOL_RANGE_JPEG); + } + + if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED || + avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || + avctx->color_trc != AVCOL_TRC_UNSPECIFIED) { + param.sSpatialLayers[0].bVideoSignalTypePresent = true; + 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;