[FFmpeg-cvslog] lavc/hevc_ps: Fix default display window offsets for yuv422 and yuv444.

Carl Eugen Hoyos git at videolan.org
Sun Mar 13 13:16:16 CET 2016


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sun Mar 13 13:15:17 2016 +0100| [4405ff2cae5066b68552bb529a7b49efc1413899] | committer: Carl Eugen Hoyos

lavc/hevc_ps: Fix default display window offsets for yuv422 and yuv444.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4405ff2cae5066b68552bb529a7b49efc1413899
---

 libavcodec/hevc_ps.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index a36c6ee..ce3f3df 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -596,11 +596,12 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
     memcpy(&backup, gb, sizeof(backup));
 
     if (vui->default_display_window_flag) {
-        //TODO: * 2 is only valid for 420
-        vui->def_disp_win.left_offset   = get_ue_golomb_long(gb) * 2;
-        vui->def_disp_win.right_offset  = get_ue_golomb_long(gb) * 2;
-        vui->def_disp_win.top_offset    = get_ue_golomb_long(gb) * 2;
-        vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) * 2;
+        int vert_mult  = 1 + (sps->chroma_format_idc < 2);
+        int horiz_mult = 1 + (sps->chroma_format_idc < 3);
+        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;
+        vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) *  vert_mult;
 
         if (apply_defdispwin &&
             avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) {



More information about the ffmpeg-cvslog mailing list