[vlc-commits] packetizer: hevc: parse pic timing
Francois Cartegnie
git at videolan.org
Wed Apr 5 14:19:58 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 4 18:25:17 2017 +0200| [bd2d71dc28466358997ee1cb1b818f3edfcaec91] | committer: Francois Cartegnie
packetizer: hevc: parse pic timing
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd2d71dc28466358997ee1cb1b818f3edfcaec91
---
modules/packetizer/hevc_nal.c | 43 +++++++++++++++++++++++++++++++++++++++++++
modules/packetizer/hevc_nal.h | 11 ++++++++++-
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 6a90868..a0cfe05 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1307,3 +1307,46 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
return pocMSB + p_slice->pic_order_cnt_lsb;
}
+
+struct hevc_sei_pic_timing_t
+{
+ nal_u4_t pic_struct;
+};
+
+void hevc_release_sei_pic_timing( hevc_sei_pic_timing_t *p_timing )
+{
+ free( p_timing );
+}
+
+hevc_sei_pic_timing_t * hevc_decode_sei_pic_timing( bs_t *p_bs,
+ const hevc_sequence_parameter_set_t *p_sps )
+{
+ hevc_sei_pic_timing_t *p_timing = malloc(sizeof(*p_timing));
+ if( p_timing )
+ {
+ if( p_sps->vui.frame_field_info_present_flag )
+ p_timing->pic_struct = bs_read( p_bs, 4 );
+ else
+ p_timing->pic_struct = 0;
+ }
+ return p_timing;
+}
+
+uint8_t hevc_get_num_clock_ts( const hevc_sequence_parameter_set_t *p_sps,
+ const hevc_sei_pic_timing_t *p_timing )
+{
+ if( p_sps->vui.frame_field_info_present_flag && p_timing && p_timing->pic_struct < 13 )
+ {
+ /* !WARN modified with units_field_based_flag (D.3.25) for values 0, 7 and 8 */
+ const uint8_t rgi_numclock[13] = { 2, 1, 1, 2, 2, 3, 3, 4, 6, 1, 1, 1, 1 };
+ return rgi_numclock[p_timing->pic_struct];
+ }
+
+ if( p_sps->vui_parameters_present_flag )
+ {
+ if( p_sps->vui.field_seq_flag )
+ return 1; /* D.3.27 */
+ }
+
+ return 2;
+}
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index cba43a8..2ed321c 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -20,8 +20,8 @@
#ifndef HEVC_NAL_H
# define HEVC_NAL_H
-# include <vlc_common.h>
# include <vlc_es.h>
+# include <vlc_bits.h>
#define HEVC_VPS_ID_MAX 15
#define HEVC_SPS_ID_MAX 15
@@ -213,4 +213,13 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
const hevc_slice_segment_header_t *slice,
hevc_poc_ctx_t *ctx );
+typedef struct hevc_sei_pic_timing_t hevc_sei_pic_timing_t;
+
+hevc_sei_pic_timing_t * hevc_decode_sei_pic_timing( bs_t *,
+ const hevc_sequence_parameter_set_t * );
+void hevc_release_sei_pic_timing( hevc_sei_pic_timing_t * );
+
+uint8_t hevc_get_num_clock_ts( const hevc_sequence_parameter_set_t *,
+ const hevc_sei_pic_timing_t * /* can be NULL */ );
+
#endif /* HEVC_NAL_H */
More information about the vlc-commits
mailing list