[vlc-commits] hevc_nal: add hevc_get_picture_size

Francois Cartegnie git at videolan.org
Tue Dec 15 17:23:47 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 14 18:53:20 2015 +0100| [4a7db3bcea78ce088c26ac7f5b15f52bc05d78f7] | committer: Francois Cartegnie

hevc_nal: add hevc_get_picture_size

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

 modules/packetizer/hevc_nal.c |   21 +++++++++++++++++++++
 modules/packetizer/hevc_nal.h |    2 ++
 2 files changed, 23 insertions(+)

diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 14db1a4..991d929 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -609,6 +609,27 @@ hevc_picture_parameter_set_t * hevc_rbsp_decode_pps( const uint8_t *p_buf, size_
     return p_pps;
 }
 
+bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *p_sps,
+                            unsigned *p_w, unsigned *p_h, unsigned *p_vw, unsigned *p_vh )
+{
+    *p_w = *p_vw = p_sps->pic_width_in_luma_samples;
+    *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_vh -= p_sps->conf_win.left_offset +  p_sps->conf_win.right_offset;
+    }
+    return true;
+}
+
+static inline uint8_t vlc_ceil_log2( uint32_t val )
+{
+    uint8_t n = 31 - clz(val);
+    if (((unsigned)1 << n) != val)
+        n++;
+    return n;
+}
+
 static bool hevc_get_picture_CtbsYsize( const hevc_sequence_parameter_set_t *p_sps, unsigned *p_w, unsigned *p_h )
 {
     const unsigned int MinCbLog2SizeY = p_sps->log2_min_luma_coding_block_size_minus3 + 3;
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index cc7aa4f..149c309 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -155,5 +155,7 @@ uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
                                    size_t *pi_res, uint8_t *pi_nal_length_size );
 
 bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id);
+bool hevc_get_picture_size( const hevc_sequence_parameter_set_t *, unsigned *p_w, unsigned *p_h,
+                            unsigned *p_vw, unsigned *p_vh );
 
 #endif /* HEVC_NAL_H */



More information about the vlc-commits mailing list