1 /*! 2 * \copy 3 * Copyright (c) 2009-2013, Cisco Systems 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 * 31 * 32 * \file au_set.h 33 * 34 * \brief Interfaces introduced in Access Unit level based writer 35 * 36 * \date 05/18/2009 Created 37 * 05/21/2009 Added init_sps and init_pps 38 * 39 ************************************************************************************* 40 */ 41 42 #ifndef WELS_ACCESS_UNIT_WRITER_H__ 43 #define WELS_ACCESS_UNIT_WRITER_H__ 44 45 #include "parameter_sets.h" 46 #include "paraset_strategy.h" 47 #include "param_svc.h" 48 #include "utils.h" 49 namespace WelsEnc { 50 /*! 51 ************************************************************************************* 52 * \brief to write Sequence Parameter Set (SPS) 53 * 54 * \param pSps SWelsSPS to be wrote 55 * \param bs_aux bitstream writer auxiliary 56 * 57 * \return 0 - successed 58 * 1 - failed 59 * 60 * \note Call it in case EWelsNalUnitType is SPS. 61 ************************************************************************************* 62 */ 63 64 int32_t WelsWriteSpsNal (SWelsSPS* pSps, SBitStringAux* pBitStringAux, int32_t* pSpsIdDelta); 65 66 67 /*! 68 ************************************************************************************* 69 * \brief to write SubSet Sequence Parameter Set 70 * 71 * \param sub_sps subset pSps parsed 72 * \param bs_aux bitstream writer auxiliary 73 * 74 * \return 0 - successed 75 * 1 - failed 76 * 77 * \note Call it in case EWelsNalUnitType is SubSet SPS. 78 ************************************************************************************* 79 */ 80 int32_t WelsWriteSubsetSpsSyntax (SSubsetSps* pSubsetSps, SBitStringAux* pBitStringAux , int32_t* pSpsIdDelta); 81 82 83 /*! 84 ************************************************************************************* 85 * \brief to write Picture Parameter Set (PPS) 86 * 87 * \param pPps pPps 88 * \param bs_aux bitstream writer auxiliary 89 * 90 * \return 0 - successed 91 * 1 - failed 92 * 93 * \note Call it in case EWelsNalUnitType is PPS. 94 ************************************************************************************* 95 */ 96 int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, IWelsParametersetStrategy* pParametersetStrategy); 97 98 /*! 99 * \brief initialize pSps based on configurable parameters in svc 100 * \param pSps SWelsSPS* 101 * \param pLayerParam SSpatialLayerConfig dependency layer parameter 102 * \param pLayerParamInternal SSpatialLayerInternal*, internal dependency layer parameter 103 * \param iSpsId SPS Id 104 * \return 0 - successful 105 * 1 - failed 106 */ 107 int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialLayerInternal* pLayerParamInternal, 108 const uint32_t kuiIntraPeriod, const int32_t kiNumRefFrame, 109 const uint32_t kiSpsId, const bool kbEnableFrameCropping, bool bEnableRc, 110 const int32_t kiDlayerCount,bool bSVCBaselayer); 111 112 /*! 113 * \brief initialize subset pSps based on configurable parameters in svc 114 * \param pSubsetSps SSubsetSps* 115 * \param pLayerParam SSpatialLayerConfig dependency layer parameter 116 * \param pLayerParamInternal SSpatialLayerInternal*, internal dependency layer parameter 117 * \param kiSpsId SPS Id 118 * \return 0 - successful 119 * 1 - failed 120 */ 121 int32_t WelsInitSubsetSps (SSubsetSps* pSubsetSps, SSpatialLayerConfig* pLayerParam, 122 SSpatialLayerInternal* pLayerParamInternal, 123 const uint32_t kuiIntraPeriod, const int32_t kiNumRefFrame, 124 const uint32_t kiSpsId, const bool kbEnableFrameCropping, bool bEnableRc, 125 const int32_t kiDlayerCount); 126 127 /*! 128 * \brief initialize pPps based on configurable parameters and pSps(subset pSps) in svc 129 * \param pPps SWelsPPS* 130 * \param pSps SWelsSPS* 131 * \param pSubsetSps SSubsetSps* 132 * \param kbDeblockingFilterPresentFlag bool 133 * \param kiPpsId PPS Id 134 * \param kbUsingSubsetSps bool 135 * \return 0 - successful 136 * 1 - failed 137 */ 138 int32_t WelsInitPps (SWelsPPS* pPps, 139 SWelsSPS* pSps, 140 SSubsetSps* pSubsetSps, 141 const uint32_t kuiPpsId, 142 const bool kbDeblockingFilterPresentFlag, 143 const bool kbUsingSubsetSps, 144 const bool kbEntropyCodingModeFlag); 145 146 int32_t WelsCheckRefFrameLimitationNumRefFirst (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam); 147 int32_t WelsCheckRefFrameLimitationLevelIdcFirst (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam); 148 149 int32_t WelsAdjustLevel (SSpatialLayerConfig* pSpatialLayer,const SLevelLimits *pCurLevel); 150 151 } 152 #endif//WELS_ACCESS_UNIT_PARSER_H__ 153