Message ID | 20180411114610.6700-1-h.leppkes@gmail.com |
---|---|
State | New |
Headers | show |
On 4/11/2018 8:46 AM, Hendrik Leppkes wrote: > --- > libavcodec/hevcdec.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index c8877626d2..e8227a510b 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -344,6 +344,17 @@ static void export_stream_params(AVCodecContext *avctx, const HEVCParamSets *ps, > avctx->colorspace = AVCOL_SPC_UNSPECIFIED; > } > > + if (sps->chroma_format_idc == 1) { > + if (sps->vui.chroma_loc_info_present_flag) { > + if (sps->vui.chroma_sample_loc_type_top_field <= 5) > + avctx->chroma_sample_location = sps->vui.chroma_sample_loc_type_top_field + 1; > + else > + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; > + } else > + avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; > + } else > + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; > + Nit: It's probably cleaner to set it to AVCHROMA_LOC_UNSPECIFIED right before doing thsee bitstream checks, instead of duplicating the else case. > if (vps->vps_timing_info_present_flag) { > num = vps->vps_num_units_in_tick; > den = vps->vps_time_scale; >
On Wed, Apr 11, 2018 at 1:46 PM, Hendrik Leppkes <h.leppkes@gmail.com> wrote: > --- > libavcodec/hevcdec.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index c8877626d2..e8227a510b 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -344,6 +344,17 @@ static void export_stream_params(AVCodecContext *avctx, const HEVCParamSets *ps, > avctx->colorspace = AVCOL_SPC_UNSPECIFIED; > } > > + if (sps->chroma_format_idc == 1) { > + if (sps->vui.chroma_loc_info_present_flag) { > + if (sps->vui.chroma_sample_loc_type_top_field <= 5) > + avctx->chroma_sample_location = sps->vui.chroma_sample_loc_type_top_field + 1; > + else > + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; > + } else > + avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; > + } else > + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; > + > if (vps->vps_timing_info_present_flag) { > num = vps->vps_num_units_in_tick; > den = vps->vps_time_scale; If there are no further comments, i'll apply this soon with the nit addressed. - Hendrik
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index c8877626d2..e8227a510b 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -344,6 +344,17 @@ static void export_stream_params(AVCodecContext *avctx, const HEVCParamSets *ps, avctx->colorspace = AVCOL_SPC_UNSPECIFIED; } + if (sps->chroma_format_idc == 1) { + if (sps->vui.chroma_loc_info_present_flag) { + if (sps->vui.chroma_sample_loc_type_top_field <= 5) + avctx->chroma_sample_location = sps->vui.chroma_sample_loc_type_top_field + 1; + else + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; + } else + avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; + } else + avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED; + if (vps->vps_timing_info_present_flag) { num = vps->vps_num_units_in_tick; den = vps->vps_time_scale;