From e4b433c32881308755d4600f0013fd0a4a0b5b71 Mon Sep 17 00:00:00 2001
From: Jack Haughton <jack.haughton@argondesign.com>
Date: Wed, 15 Oct 2014 11:41:42 +0100
Subject: [PATCH] Bug fix: set m_pocRandomAccess correctly
---
source/Lib/TLibDecoder/TDecTop.cpp | 40 +++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/source/Lib/TLibDecoder/TDecTop.cpp b/source/Lib/TLibDecoder/TDecTop.cpp
index d3d5970..0bacd17 100644
a
|
b
|
Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay) |
839 | 839 | iSkipFrame--; // decrement the counter |
840 | 840 | return true; |
841 | 841 | } |
842 | | else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. |
| 842 | |
| 843 | if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) |
843 | 844 | { |
844 | | if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA |
| 845 | m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. |
| 846 | } |
| 847 | else if ( (m_pocRandomAccess == MAX_INT && m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) |
845 | 848 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
846 | 849 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
847 | 850 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) |
848 | | { |
849 | | // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. |
850 | | m_pocRandomAccess = m_apcSlicePilot->getPOC(); |
851 | | } |
852 | | else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) |
853 | | { |
854 | | m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. |
855 | | } |
856 | | else |
857 | | { |
858 | | static Bool warningMessage = false; |
| 851 | { |
| 852 | // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. |
| 853 | m_pocRandomAccess = m_apcSlicePilot->getPOC(); |
| 854 | } |
| 855 | else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && |
| 856 | m_pocRandomAccess!=m_apcSlicePilot->getPOC()) |
| 857 | { |
| 858 | m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in mid-CVS CRA, they are decodable. |
| 859 | } |
| 860 | if ( m_pocRandomAccess == MAX_INT && |
| 861 | m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_CRA |
| 862 | && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_BLA_W_LP |
| 863 | && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_BLA_N_LP |
| 864 | && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL |
| 865 | && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL |
| 866 | && m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_N_LP ) |
| 867 | { |
| 868 | static Bool warningMessage = false; |
859 | 869 | if(!warningMessage) |
860 | 870 | { |
861 | 871 | printf("\nWarning: this is not a valid random access point and the data is discarded until the first CRA picture"); |
862 | 872 | warningMessage = true; |
863 | 873 | } |
864 | 874 | return true; |
865 | | } |
866 | 875 | } |
867 | | // skip the reordered pictures, if necessary |
868 | | else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) |
| 876 | if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) |
869 | 877 | { |
870 | 878 | iPOCLastDisplay++; |
871 | 879 | return true; |