diff options
author | James Almer <jamrial@gmail.com> | 2017-04-30 16:49:41 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-05-05 17:30:36 -0300 |
commit | 1d53b8e9073c93f75abb1fd2cde6ef6d21c2a22c (patch) | |
tree | ce440605e971ccf03dc1b709033b520b6ee6fe2f /libavcodec/hevc_ps.c | |
parent | a687fb997097ac1d1870b6de5160d45e5f57e871 (diff) | |
download | ffmpeg-1d53b8e9073c93f75abb1fd2cde6ef6d21c2a22c.tar.gz |
avcodec/hevcdec: remove HEVCContext usage from ff_hevc_compute_poc()
Move it to hevc_ps as well. This is in preparation for a following patch.
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hevc_ps.c')
-rw-r--r-- | libavcodec/hevc_ps.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 6d67dd9c69..b5a970e4f7 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -1665,3 +1665,26 @@ err: av_buffer_unref(&pps_buf); return ret; } + +int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type) +{ + int max_poc_lsb = 1 << sps->log2_max_poc_lsb; + int prev_poc_lsb = pocTid0 % max_poc_lsb; + int prev_poc_msb = pocTid0 - prev_poc_lsb; + int poc_msb; + + if (poc_lsb < prev_poc_lsb && prev_poc_lsb - poc_lsb >= max_poc_lsb / 2) + poc_msb = prev_poc_msb + max_poc_lsb; + else if (poc_lsb > prev_poc_lsb && poc_lsb - prev_poc_lsb > max_poc_lsb / 2) + poc_msb = prev_poc_msb - max_poc_lsb; + else + poc_msb = prev_poc_msb; + + // For BLA picture types, POCmsb is set to 0. + if (nal_unit_type == HEVC_NAL_BLA_W_LP || + nal_unit_type == HEVC_NAL_BLA_W_RADL || + nal_unit_type == HEVC_NAL_BLA_N_LP) + poc_msb = 0; + + return poc_msb + poc_lsb; +} |