2013-12-09 13:51:09 +01:00
|
|
|
/*!
|
|
|
|
* \copy
|
|
|
|
* Copyright (c) 2009-2013, Cisco Systems
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Abstract
|
|
|
|
* Cisco OpenH264 encoder extension utilization interface for T26
|
|
|
|
*
|
|
|
|
* History
|
|
|
|
* 4/24/2009 Created
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*************************************************************************/
|
2014-06-10 09:25:07 +02:00
|
|
|
#if !defined(WELS_PLUS_WELSENCODEREXT_H)
|
|
|
|
#define WELS_PLUS_WELSENCODEREXT_H
|
2013-12-09 13:51:09 +01:00
|
|
|
|
|
|
|
#include "codec_api.h"
|
|
|
|
#include "codec_def.h"
|
|
|
|
#include "codec_app_def.h"
|
|
|
|
#include "welsCodecTrace.h"
|
|
|
|
#include "encoder_context.h"
|
|
|
|
#include "param_svc.h"
|
|
|
|
#include "extern.h"
|
2014-01-21 04:16:48 +01:00
|
|
|
#include "cpu.h"
|
2013-12-09 13:51:09 +01:00
|
|
|
|
|
|
|
//#define OUTPUT_BIT_STREAM
|
|
|
|
//#define DUMP_SRC_PICTURE
|
|
|
|
//#define REC_FRAME_COUNT
|
|
|
|
|
|
|
|
class ISVCEncoder;
|
|
|
|
namespace WelsSVCEnc {
|
2013-12-12 23:21:12 +01:00
|
|
|
class CWelsH264SVCEncoder : public ISVCEncoder {
|
|
|
|
public:
|
|
|
|
CWelsH264SVCEncoder();
|
|
|
|
virtual ~CWelsH264SVCEncoder();
|
|
|
|
|
|
|
|
/* Interfaces override from ISVCEncoder */
|
|
|
|
/*
|
|
|
|
* return: CM_RETURN: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-02-18 11:29:43 +01:00
|
|
|
virtual int EXTAPI Initialize (const SEncParamBase* argv);
|
|
|
|
virtual int EXTAPI InitializeExt (const SEncParamExt* argv);
|
2013-12-12 23:21:12 +01:00
|
|
|
|
2014-02-26 21:08:41 +01:00
|
|
|
virtual int EXTAPI GetDefaultParams (SEncParamExt* argv);
|
|
|
|
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI Uninitialize();
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/*
|
2014-03-18 09:03:08 +01:00
|
|
|
* return: 0 - success; otherwise - failed;
|
2013-12-12 23:21:12 +01:00
|
|
|
*/
|
2014-02-20 03:33:07 +01:00
|
|
|
virtual int EXTAPI EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo);
|
2014-02-28 08:13:38 +01:00
|
|
|
virtual int EncodeFrameInternal (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo);
|
2013-12-12 23:21:12 +01:00
|
|
|
|
2014-01-10 19:46:05 +01:00
|
|
|
/*
|
|
|
|
* return: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI EncodeParameterSets (SFrameBSInfo* pBsInfo);
|
2014-01-10 19:46:05 +01:00
|
|
|
|
2013-12-12 23:21:12 +01:00
|
|
|
/*
|
|
|
|
* return: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-02-20 03:33:07 +01:00
|
|
|
virtual int EXTAPI PauseFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo);
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* return: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI ForceIntraFrame (bool bIDR);
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..
|
|
|
|
************************************************************************/
|
|
|
|
/*
|
|
|
|
* return: CM_RETURN: 0 - success; otherwise - failed;
|
|
|
|
*/
|
2014-01-21 15:12:57 +01:00
|
|
|
virtual int EXTAPI SetOption (ENCODER_OPTION opt_id, void* option);
|
|
|
|
virtual int EXTAPI GetOption (ENCODER_OPTION opt_id, void* option);
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
private:
|
2014-04-07 20:30:12 +02:00
|
|
|
int InitializeInternal (SWelsSvcCodingParam* argv);
|
2014-06-20 10:02:56 +02:00
|
|
|
void CheckProfileSetting (int32_t iLayer, EProfileIdc uiProfileIdc);
|
|
|
|
void CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc);
|
|
|
|
void CheckReferenceNumSetting (int32_t iNumRef);
|
2013-12-12 23:21:12 +01:00
|
|
|
sWelsEncCtx* m_pEncContext;
|
|
|
|
|
|
|
|
welsCodecTrace* m_pWelsTrace;
|
|
|
|
int32_t m_iMaxPicWidth;
|
|
|
|
int32_t m_iMaxPicHeight;
|
|
|
|
|
|
|
|
int32_t m_iCspInternal;
|
2014-02-08 22:24:33 +01:00
|
|
|
bool m_bInitialFlag;
|
2013-12-09 13:51:09 +01:00
|
|
|
|
|
|
|
#ifdef OUTPUT_BIT_STREAM
|
2013-12-12 23:21:12 +01:00
|
|
|
FILE* m_pFileBs;
|
|
|
|
FILE* m_pFileBsSize;
|
2014-02-08 22:24:33 +01:00
|
|
|
bool m_bSwitch;
|
2013-12-12 23:21:12 +01:00
|
|
|
int32_t m_iSwitchTimes;
|
2013-12-09 13:51:09 +01:00
|
|
|
#endif//OUTPUT_BIT_STREAM
|
|
|
|
|
|
|
|
#ifdef REC_FRAME_COUNT
|
2013-12-12 23:21:12 +01:00
|
|
|
int32_t m_uiCountFrameNum;
|
2013-12-09 13:51:09 +01:00
|
|
|
#endif//REC_FRAME_COUNT
|
2013-12-12 23:21:12 +01:00
|
|
|
|
|
|
|
void InitEncoder (void);
|
|
|
|
void DumpSrcPicture (const uint8_t* pSrc);
|
2013-12-09 13:51:09 +01:00
|
|
|
};
|
|
|
|
}
|
2014-06-10 09:25:07 +02:00
|
|
|
#endif // !defined(WELS_PLUS_WELSENCODEREXT_H)
|