[vlc-commits] packetizer: hevc: don't double store poc prev msb/lsb
Francois Cartegnie
git at videolan.org
Thu Dec 14 14:08:52 CET 2017
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 14 13:49:39 2017 +0100| [115c4a55a728ac504f8285f70d19c56ed9d873bb] | committer: Francois Cartegnie
packetizer: hevc: don't double store poc prev msb/lsb
(cherry picked from commit d6c05044b85cd398ab89b61f5e89d866a574ad2e)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=115c4a55a728ac504f8285f70d19c56ed9d873bb
---
modules/packetizer/hevc_nal.c | 22 ++++++++++++----------
modules/packetizer/hevc_nal.h | 6 +++---
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 4afb1c6573..7b66316fa2 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1454,6 +1454,11 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
const hevc_slice_segment_header_t *p_slice,
hevc_poc_ctx_t *p_ctx )
{
+ struct
+ {
+ int lsb;
+ int msb;
+ } prevPicOrderCnt;
int pocMSB;
bool NoRaslOutputFlag;
bool IsIRAP = ( p_slice->nal_type >= HEVC_NAL_BLA_W_LP &&
@@ -1478,15 +1483,14 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
if( p_slice->nal_type == HEVC_NAL_IDR_N_LP ||
p_slice->nal_type == HEVC_NAL_IDR_W_RADL )
{
- p_ctx->prevPicOrderCnt.msb = 0;
- p_ctx->prevPicOrderCnt.lsb = 0;
+ prevPicOrderCnt.msb = 0;
+ prevPicOrderCnt.lsb = 0;
}
-
/* Not an IRAP with NoRaslOutputFlag == 1 */
- if( !IsIRAP || !NoRaslOutputFlag )
+ else if( !IsIRAP || !NoRaslOutputFlag )
{
- p_ctx->prevPicOrderCnt.msb = p_ctx->prevTid0PicOrderCnt.msb;
- p_ctx->prevPicOrderCnt.lsb = p_ctx->prevTid0PicOrderCnt.lsb;
+ prevPicOrderCnt.msb = p_ctx->prevTid0PicOrderCnt.msb;
+ prevPicOrderCnt.lsb = p_ctx->prevTid0PicOrderCnt.lsb;
}
if( IsIRAP && NoRaslOutputFlag )
@@ -1496,8 +1500,8 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
else
{
const unsigned maxPocLSB = 1U << (p_sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
- pocMSB = p_ctx->prevPicOrderCnt.msb;
- int64_t orderDiff = (int64_t)p_slice->pic_order_cnt_lsb - p_ctx->prevPicOrderCnt.lsb;
+ pocMSB = prevPicOrderCnt.msb;
+ int64_t orderDiff = (int64_t)p_slice->pic_order_cnt_lsb - prevPicOrderCnt.lsb;
if( orderDiff < 0 && -orderDiff >= maxPocLSB / 2 )
pocMSB += maxPocLSB;
else if( orderDiff > maxPocLSB / 2 )
@@ -1513,8 +1517,6 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
p_ctx->prevTid0PicOrderCnt.lsb = p_slice->pic_order_cnt_lsb;
}
- p_ctx->prevPicOrderCnt.msb = pocMSB;
- p_ctx->prevPicOrderCnt.lsb = p_slice->pic_order_cnt_lsb;
p_ctx->first_picture = false;
return pocMSB + p_slice->pic_order_cnt_lsb;
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index cbba2127ee..ed4c9cade1 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -246,7 +246,7 @@ typedef struct
{
int lsb;
int msb;
- } prevPicOrderCnt, prevTid0PicOrderCnt;
+ } prevTid0PicOrderCnt;
bool HandleCraAsBlaFlag;
bool first_picture; /* Must be set on start or on NAL_EOS */
@@ -254,8 +254,8 @@ typedef struct
static inline void hevc_poc_cxt_init( hevc_poc_ctx_t *p_ctx )
{
- p_ctx->prevPicOrderCnt.lsb = 0;
- p_ctx->prevPicOrderCnt.msb = 0;
+ p_ctx->prevTid0PicOrderCnt.lsb = 0;
+ p_ctx->prevTid0PicOrderCnt.msb = 0;
p_ctx->first_picture = true;
}
More information about the vlc-commits
mailing list