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 extern.h 33 * 34 * \brief extern interfaces between core and plus of wels encoder 35 * 36 * \date 4/21/2009 Created 37 * 38 ************************************************************************************* 39 */ 40 #if !defined(WELS_ENCODER_EXTERN_H__) 41 #define WELS_ENCODER_EXTERN_H__ 42 43 #include "typedefs.h" 44 #include "encoder_context.h" 45 46 namespace WelsEnc { 47 48 /*! 49 * \brief initialize source picture body 50 * \param kpSrc SSourcePicture* 51 * \param kiCsp internal csp format 52 * \param kiWidth widht of picture in pixels 53 * \param kiHeight height of picture in pixels 54 * \return successful - 0; otherwise none 0 for failed 55 */ 56 int32_t InitPic (const void* kpSrc, const int32_t kiCsp, const int32_t kiWidth, const int32_t kiHeight); 57 58 /* 59 * SVC core encoder external interfaces 60 */ 61 62 /*! 63 * \brief validate checking in parameter configuration 64 * \pParam pParam SWelsSvcCodingParam* 65 * \return successful - 0; otherwise none 0 for failed 66 */ 67 int32_t ParamValidationExt (SLogContext* pCtx, SWelsSvcCodingParam* pParam); 68 69 // GOM based RC related for uiSliceNum decision 70 void GomValidCheck (const int32_t kiMbWidth, const int32_t kiMbHeight, int32_t* pSliceNum); 71 72 /*! 73 * \brief initialize Wels avc encoder core library 74 * \param ppCtx sWelsEncCtx** 75 * \param para SWelsSvcCodingParam* 76 * \return successful - 0; otherwise none 0 for failed 77 */ 78 int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pPara, SLogContext* pLogCtx, 79 SExistingParasetList* pExistingParasetList); 80 81 /*! 82 * \brief uninitialize Wels encoder core library 83 * \param pEncCtx sWelsEncCtx* 84 * \return none 85 */ 86 void WelsUninitEncoderExt (sWelsEncCtx** ppCtx); 87 88 /*! 89 * \brief core svc encoding process 90 * 91 * \param h sWelsEncCtx*, encoder context 92 * \param pFbi FrameBSInfo* 93 * \param kpSrcPic Source picture 94 * \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP) 95 */ 96 int32_t WelsEncoderEncodeExt (sWelsEncCtx*, SFrameBSInfo* pFbi, const SSourcePicture* kpSrcPic); 97 98 int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst); 99 100 /* 101 * Force coding IDR as follows 102 */ 103 int32_t ForceCodingIDR (sWelsEncCtx* pCtx,int32_t iLayerId); 104 105 /*! 106 * \brief Wels SVC encoder parameters adjustment 107 * SVC adjustment results in new requirement in memory blocks adjustment 108 */ 109 int32_t WelsBitRateVerification(SLogContext* pLogCtx,SSpatialLayerConfig* pLayerParam,int32_t iLayerId); 110 int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNew); 111 void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam); 112 int32_t WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iLayer); 113 int32_t WelsEncoderApplyBitVaryRang(SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iRang); 114 int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue); 115 int32_t DynSliceRealloc(sWelsEncCtx* pCtx,SFrameBSInfo* pFrameBsInfo,SLayerBSInfo* pLayerBsInfo); 116 int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRecoverRequest); 117 void CheckProfileSetting (SLogContext* pLogCtx,SWelsSvcCodingParam* pParam,int32_t iLayer, EProfileIdc uiProfileIdc); 118 void CheckLevelSetting (SLogContext* pLogCtx,SWelsSvcCodingParam* pParam,int32_t iLayer, ELevelIdc uiLevelIdc); 119 void CheckReferenceNumSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam,int32_t iNumRef); 120 void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarkingFeedback); 121 } 122 123 #endif//WELS_ENCODER_CALLBACK_H__ 124 125