Skip to content
Snippets Groups Projects
DecLib.cpp 71.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • #if JVET_O0179
        case NAL_UNIT_RESERVED_IRAP_VCL_12:
        case NAL_UNIT_RESERVED_IRAP_VCL_13:
    #else
    
        case NAL_UNIT_RESERVED_VCL_12:
        case NAL_UNIT_RESERVED_VCL_13:
    
        case NAL_UNIT_RESERVED_VCL_14:
        case NAL_UNIT_RESERVED_VCL_15:
    
          msg( NOTICE, "Note: found reserved VCL NAL unit.\n");
          xParsePrefixSEIsForUnknownVCLNal();
          return false;
    
    #if JVET_O0179
        case NAL_UNIT_RESERVED_VCL_4:
        case NAL_UNIT_RESERVED_VCL_5:
        case NAL_UNIT_RESERVED_VCL_6:
        case NAL_UNIT_RESERVED_VCL_7:
        case NAL_UNIT_RESERVED_NVCL_26:
        case NAL_UNIT_RESERVED_NVCL_27:
    #else
    
        case NAL_UNIT_RESERVED_NVCL_5:
        case NAL_UNIT_RESERVED_NVCL_6:
        case NAL_UNIT_RESERVED_NVCL_7:
        case NAL_UNIT_RESERVED_NVCL_21:
        case NAL_UNIT_RESERVED_NVCL_22:
        case NAL_UNIT_RESERVED_NVCL_23:
    
          msg( NOTICE, "Note: found reserved NAL unit.\n");
          return false;
    
        case NAL_UNIT_UNSPECIFIED_28:
        case NAL_UNIT_UNSPECIFIED_29:
        case NAL_UNIT_UNSPECIFIED_30:
        case NAL_UNIT_UNSPECIFIED_31:
    
          msg( NOTICE, "Note: found unspecified NAL unit.\n");
          return false;
        default:
          THROW( "Invalid NAL unit type" );
          break;
      }
    
      return false;
    }
    
    
    /** Function for checking if picture should be skipped because of random access. This function checks the skipping of pictures in the case of -s option random access.
     *  All pictures prior to the random access point indicated by the counter iSkipFrame are skipped.
     *  It also checks the type of Nal unit type at the random access point.
     *  If the random access point is CRA/CRANT/BLA/BLANT, TFD pictures with POC less than the POC of the random access point are skipped.
     *  If the random access point is IDR all pictures after the random access point are decoded.
     *  If the random access point is none of the above, a warning is issues, and decoding of pictures with POC
     *  equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random
     *  access point there is no guarantee that the decoder will not crash.
     */
    bool DecLib::isRandomAccessSkipPicture( int& iSkipFrame, int& iPOCLastDisplay )
    {
      if (iSkipFrame)
      {
        iSkipFrame--;   // decrement the counter
        return true;
      }
      else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
      {
    
        if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )
    
        {
          // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
          m_pocRandomAccess = m_apcSlicePilot->getPOC();
        }
        else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
        {
          m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
        }
        else
        {
          if(!m_warningMessageSkipPicture)
          {
            msg( WARNING, "\nWarning: this is not a valid random access point and the data is discarded until the first CRA picture");
            m_warningMessageSkipPicture = true;
          }
          return true;
        }
      }
      // skip the reordered pictures, if necessary
    
      else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL))
    
      {
        iPOCLastDisplay++;
        return true;
      }
      // if we reach here, then the picture is not skipped.
      return false;
    }
    
    
    
    
    //! \}