[vlc-commits] packetizer: hevc_nal: fix visiable size

Zhao Zhili git at videolan.org
Thu Aug 16 12:47:53 CEST 2018


vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Thu Aug 16 11:18:36 2018 +0800| [596b67eb798ca4fa37ca61c2e576cefebe3c92c9] | committer: Francois Cartegnie

packetizer: hevc_nal: fix visiable size

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=596b67eb798ca4fa37ca61c2e576cefebe3c92c9
---

 modules/packetizer/hevc_nal.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index f154efd5ee..bc47f79e55 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1068,8 +1068,26 @@ bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *p_sps,
     *p_h = *p_vh = p_sps->pic_height_in_luma_samples;
     if( p_sps->conformance_window_flag )
     {
-        *p_vh -= p_sps->conf_win.bottom_offset + p_sps->conf_win.top_offset;
-        *p_vw -= p_sps->conf_win.left_offset +  p_sps->conf_win.right_offset;
+        unsigned sub_width_c, sub_height_c;
+
+        if( p_sps->chroma_format_idc == 1 )
+        {
+            sub_width_c = 2;
+            sub_height_c = 2;
+        }
+        else if( p_sps->chroma_format_idc == 2 )
+        {
+            sub_width_c = 2;
+            sub_height_c = 1;
+        }
+        else
+        {
+            sub_width_c = 1;
+            sub_height_c = 1;
+        }
+
+        *p_vh -= (p_sps->conf_win.bottom_offset + p_sps->conf_win.top_offset) * sub_height_c;
+        *p_vw -= (p_sps->conf_win.left_offset +  p_sps->conf_win.right_offset) * sub_width_c;
     }
     return true;
 }



More information about the vlc-commits mailing list