Commit d6c05044 authored by François Cartegnie's avatar François Cartegnie 🤞

packetizer: hevc: don't double store poc prev msb/lsb

parent db383e8b
...@@ -1454,6 +1454,11 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps ...@@ -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, const hevc_slice_segment_header_t *p_slice,
hevc_poc_ctx_t *p_ctx ) hevc_poc_ctx_t *p_ctx )
{ {
struct
{
int lsb;
int msb;
} prevPicOrderCnt;
int pocMSB; int pocMSB;
bool NoRaslOutputFlag; bool NoRaslOutputFlag;
bool IsIRAP = ( p_slice->nal_type >= HEVC_NAL_BLA_W_LP && 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 ...@@ -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 || if( p_slice->nal_type == HEVC_NAL_IDR_N_LP ||
p_slice->nal_type == HEVC_NAL_IDR_W_RADL ) p_slice->nal_type == HEVC_NAL_IDR_W_RADL )
{ {
p_ctx->prevPicOrderCnt.msb = 0; prevPicOrderCnt.msb = 0;
p_ctx->prevPicOrderCnt.lsb = 0; prevPicOrderCnt.lsb = 0;
} }
/* Not an IRAP with NoRaslOutputFlag == 1 */ /* Not an IRAP with NoRaslOutputFlag == 1 */
if( !IsIRAP || !NoRaslOutputFlag ) else if( !IsIRAP || !NoRaslOutputFlag )
{ {
p_ctx->prevPicOrderCnt.msb = p_ctx->prevTid0PicOrderCnt.msb; prevPicOrderCnt.msb = p_ctx->prevTid0PicOrderCnt.msb;
p_ctx->prevPicOrderCnt.lsb = p_ctx->prevTid0PicOrderCnt.lsb; prevPicOrderCnt.lsb = p_ctx->prevTid0PicOrderCnt.lsb;
} }
if( IsIRAP && NoRaslOutputFlag ) if( IsIRAP && NoRaslOutputFlag )
...@@ -1496,8 +1500,8 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps ...@@ -1496,8 +1500,8 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
else else
{ {
const unsigned maxPocLSB = 1U << (p_sps->log2_max_pic_order_cnt_lsb_minus4 + 4); const unsigned maxPocLSB = 1U << (p_sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
pocMSB = p_ctx->prevPicOrderCnt.msb; pocMSB = prevPicOrderCnt.msb;
int64_t orderDiff = (int64_t)p_slice->pic_order_cnt_lsb - p_ctx->prevPicOrderCnt.lsb; int64_t orderDiff = (int64_t)p_slice->pic_order_cnt_lsb - prevPicOrderCnt.lsb;
if( orderDiff < 0 && -orderDiff >= maxPocLSB / 2 ) if( orderDiff < 0 && -orderDiff >= maxPocLSB / 2 )
pocMSB += maxPocLSB; pocMSB += maxPocLSB;
else if( orderDiff > maxPocLSB / 2 ) else if( orderDiff > maxPocLSB / 2 )
...@@ -1513,8 +1517,6 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps ...@@ -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->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; p_ctx->first_picture = false;
return pocMSB + p_slice->pic_order_cnt_lsb; return pocMSB + p_slice->pic_order_cnt_lsb;
......
...@@ -246,7 +246,7 @@ typedef struct ...@@ -246,7 +246,7 @@ typedef struct
{ {
int lsb; int lsb;
int msb; int msb;
} prevPicOrderCnt, prevTid0PicOrderCnt; } prevTid0PicOrderCnt;
bool HandleCraAsBlaFlag; bool HandleCraAsBlaFlag;
bool first_picture; /* Must be set on start or on NAL_EOS */ bool first_picture; /* Must be set on start or on NAL_EOS */
...@@ -254,8 +254,8 @@ typedef struct ...@@ -254,8 +254,8 @@ typedef struct
static inline void hevc_poc_cxt_init( hevc_poc_ctx_t *p_ctx ) static inline void hevc_poc_cxt_init( hevc_poc_ctx_t *p_ctx )
{ {
p_ctx->prevPicOrderCnt.lsb = 0; p_ctx->prevTid0PicOrderCnt.lsb = 0;
p_ctx->prevPicOrderCnt.msb = 0; p_ctx->prevTid0PicOrderCnt.msb = 0;
p_ctx->first_picture = true; p_ctx->first_picture = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment