[vlc-devel] [PATCH] packetizer: hevc_nal: fix visiable size

Zhao Zhili quinkblack at foxmail.com
Thu Aug 16 05:18:36 CEST 2018


---
 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 f154efd..bc47f79 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;
 }
-- 
2.9.5





More information about the vlc-devel mailing list