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

Zhao Zhili git at videolan.org
Fri Aug 17 09:54:06 CEST 2018


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

packetizer: hevc_nal: fix visiable size

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>
(cherry picked from commit 596b67eb798ca4fa37ca61c2e576cefebe3c92c9)

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

 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 683717f0eb..3a0dec9065 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1065,8 +1065,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