[libav-devel] [PATCH 1/2] hevc: Set chroma_sample_location of AVCodecContext.

Vittorio Giovara vittorio.giovara at gmail.com
Mon Nov 4 14:33:21 CET 2013


On Mon, Nov 4, 2013 at 1:26 PM, Yusuke Nakamura
<muken.the.vfrmaniac at gmail.com> wrote:
> ---
>  libavcodec/hevc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
> index ed980e3..e3d306b 100644
> --- a/libavcodec/hevc.c
> +++ b/libavcodec/hevc.c
> @@ -401,6 +401,13 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
>      s->avctx->sample_aspect_ratio = sps->vui.sar;
>      s->avctx->has_b_frames        = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics;
>
> +    if (sps->vui.chroma_loc_info_present_flag)
> +        s->avctx->chroma_sample_location = sps->vui.chroma_sample_loc_type_top_field + 1;
> +    else if (sps->chroma_format_idc == 1)
> +        s->avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
> +    else
> +        s->avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
> +

I think the specs say that when chroma_format_idc is not 1 the
chroma_sample_location should be 0 (eg AVCHROMA_LOC_LEF in avcodec).
Vittorio


More information about the libav-devel mailing list