[FFmpeg-devel] [PATCH] lavc/hevc_ps: fix crop info

James Almer jamrial at gmail.com
Thu Aug 16 06:46:50 EEST 2018


On 8/16/2018 12:29 AM, Zhao Zhili wrote:
> ---
>  libavcodec/hevc_ps.c | 26 ++++++++++++++++++++++----
>  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index fbd9fbf..4161ab6 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -628,8 +628,17 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
>          vui->default_display_window_flag = get_bits1(gb);
>  
>      if (vui->default_display_window_flag) {
> -        int vert_mult  = 1 + (sps->chroma_format_idc < 2);
> -        int horiz_mult = 1 + (sps->chroma_format_idc < 3);
> +        unsigned horiz_mult, vert_mult;
> +        if (sps->chroma_format_idc == 1) {
> +            horiz_mult = 2;
> +            vert_mult = 2;
> +        } else if (sps->chroma_format_idc == 2) {
> +            horiz_mult = 2;
> +            vert_mult = 1;
> +        } else {
> +            horiz_mult = 1;
> +            vert_mult = 1;

Can you explain what this patch is meant to do? For chroma_format_idc ==
1, 2 and 3 nothing changes with this, only chroma_format_idc == 0, where
both horiz_mult and vert_mult become 1 instead of 2. Is that
correct/intended?

> +        }
>          vui->def_disp_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
>          vui->def_disp_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
>          vui->def_disp_win.top_offset    = get_ue_golomb_long(gb) *  vert_mult;
> @@ -923,8 +932,17 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
>          return ret;
>  
>      if (get_bits1(gb)) { // pic_conformance_flag
> -        int vert_mult  = 1 + (sps->chroma_format_idc < 2);
> -        int horiz_mult = 1 + (sps->chroma_format_idc < 3);
> +        unsigned horiz_mult, vert_mult;
> +        if (sps->chroma_format_idc == 1) {
> +            horiz_mult = 2;
> +            vert_mult = 2;
> +        } else if (sps->chroma_format_idc == 2) {
> +            horiz_mult = 2;
> +            vert_mult = 1;
> +        } else {
> +            horiz_mult = 1;
> +            vert_mult = 1;
> +        }
>          sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
>          sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
>          sps->pic_conf_win.top_offset    = get_ue_golomb_long(gb) *  vert_mult;
> 



More information about the ffmpeg-devel mailing list