On Thu, Aug 16, 2018 at 11:29:09AM +0800, 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; > + } > 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; > + }
this should either stay simple code or it should be factored out. duplicating this is not ideal. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "Nothing to hide" only works if the folks in power share the values of you and everyone you know entirely and always will -- Tom Scott
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel