123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- //SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause
- /*
- * Copyright (c) 2019, Chips&Media
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * 2. 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 OWNER 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.
- */
- #ifndef __VPUAPI_PRODUCT_ABSTRACT_H__
- #define __VPUAPI_PRODUCT_ABSTRACT_H__
- #ifdef USE_FEEDING_METHOD_BUFFER
- #include "wave511/vpuapi/vpuapi.h"
- #include "wave511/vpuapi/vpuapifunc.h"
- #else
- #include "vpuapi.h"
- #include "vpuapifunc.h"
- #endif
- #define IS_CODA_DECODER_HANDLE(_inst) (_inst->codecMode < AVC_ENC)
- #define IS_WAVE_DECODER_HANDLE(_inst) (_inst->codecMode == W_HEVC_DEC || _inst->codecMode == W_SVAC_DEC || _inst->codecMode == W_AVC_DEC || _inst->codecMode == W_VP9_DEC || _inst->codecMode == W_AVS2_DEC || _inst->codecMode == W_AV1_DEC)
- enum {
- FramebufCacheNone,
- FramebufCacheMaverickI,
- FramebufCacheMaverickII,
- };
- typedef struct _tag_FramebufferIndex {
- Int16 tiledIndex;
- Int16 linearIndex;
- } FramebufferIndex;
- extern VpuAttr g_VpuCoreAttributes[MAX_NUM_VPU_CORE];
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- /*
- * Returns 0 - not found product id
- * 1 - found product id
- */
- extern Uint32 ProductVpuScan(
- Uint32 coreIdx
- );
- extern Int32 ProductVpuGetId(
- Uint32 coreIdx
- );
- extern RetCode ProductVpuGetVersion(
- Uint32 coreIdx,
- Uint32* versionInfo,
- Uint32* revision
- );
- extern RetCode ProductVpuGetProductInfo(
- Uint32 coreIdx,
- VpuAttr* productInfo
- );
- extern RetCode ProductVpuInit(
- Uint32 coreIdx,
- void* firmware,
- Uint32 size
- );
- extern RetCode ProductVpuReInit(
- Uint32 coreIdx,
- void* firmware,
- Uint32 size
- );
- extern Uint32 ProductVpuIsInit(
- Uint32 coreIdx
- );
- extern Int32 ProductVpuIsBusy(
- Uint32 coreIdx
- );
- extern Int32 ProductVpuWaitInterrupt(
- CodecInst* instance,
- Int32 timeout
- );
- extern RetCode ProductVpuReset(
- Uint32 coreIdx,
- SWResetMode resetMode
- );
- extern RetCode ProductVpuSleepWake(
- Uint32 coreIdx,
- int iSleepWake,
- const Uint16* code,
- Uint32 size
- );
- extern RetCode ProductVpuClearInterrupt(
- Uint32 coreIdx,
- Uint32 flags
- );
- extern RetCode ProductVpuDecBuildUpOpenParam(
- CodecInst* instance,
- DecOpenParam* param
- );
- extern RetCode ProductCheckDecOpenParam(
- DecOpenParam* param
- );
- extern RetCode ProductVpuDecInitSeq(
- CodecInst* instance
- );
- extern RetCode ProductVpuDecFiniSeq(
- CodecInst* instance
- );
- extern RetCode ProductVpuDecSetBitstreamFlag(
- CodecInst* instance,
- BOOL running,
- Int32 size
- );
- /*
- * FINI_SEQ
- */
- extern RetCode ProductVpuDecEndSequence(
- CodecInst* instance
- );
- /**
- * @brief Abstract function for SEQ_INIT.
- */
- extern RetCode ProductVpuDecGetSeqInfo(
- CodecInst* instance,
- DecInitialInfo* info
- );
- /**
- * \brief Check parameters for product specific decoder.
- */
- extern RetCode ProductVpuDecCheckCapability(
- CodecInst* instance
- );
- /**
- * \brief Decode a coded picture.
- */
- extern RetCode ProductVpuDecode(
- CodecInst* instance,
- DecParam* option
- );
- /**
- *
- */
- extern RetCode ProductVpuDecGetResult(
- CodecInst* instance,
- DecOutputInfo* result
- );
- /**
- * \brief Flush framebuffers to prepare decoding new sequence
- * \param instance decoder handle
- * \param retIndexes Storing framebuffer indexes in display order.
- * If retIndexes[i] is -1 then there is no display index from i-th.
- */
- extern RetCode ProductVpuDecFlush(
- CodecInst* instance,
- FramebufferIndex* retIndexes,
- Uint32 size
- );
- /**
- * \brief Allocate framebuffers with given parameters
- */
- extern RetCode ProductVpuAllocateFramebuffer(
- CodecInst* instance,
- FrameBuffer* fbArr,
- TiledMapType mapType,
- Int32 num,
- Int32 stride,
- Int32 height,
- FrameBufferFormat format,
- BOOL cbcrInterleave,
- BOOL nv21,
- Int32 endian,
- vpu_buffer_t* vb,
- Int32 gdiIndex,
- FramebufferAllocType fbType
- );
- /**
- * \brief Register framebuffers to VPU
- */
- extern RetCode ProductVpuRegisterFramebuffer(
- CodecInst* instance
- );
- extern RetCode ProductVpuDecUpdateFrameBuffer(
- CodecInst* instance,
- FrameBuffer* fbcFb,
- FrameBuffer* linearFb,
- Uint32 mvColIndex,
- Uint32 picWidth,
- Uint32 picHeight
- );
- extern Int32 ProductCalculateFrameBufSize(
- CodecInst* inst,
- Int32 productId,
- Int32 stride,
- Int32 height,
- TiledMapType mapType,
- FrameBufferFormat format,
- BOOL interleave,
- DRAMConfig* pDramCfg
- );
- extern Int32 ProductCalculateAuxBufferSize(
- AUX_BUF_TYPE type,
- CodStd codStd,
- Int32 width,
- Int32 height
- );
- extern RetCode ProductClrDispFlag(
- CodecInst* instance,
- Uint32 index
- );
- extern RetCode ProductSetDispFlag(
- CodecInst* instance,
- Uint32 dispFlag
- );
- extern PhysicalAddress ProductVpuDecGetRdPtr(
- CodecInst* instance
- );
- extern RetCode ProductVpuGetBandwidth(
- CodecInst* instance,
- VPUBWData* data
- );
- extern RetCode ProductVpuGetDebugInfo(
- CodecInst* instance,
- VPUDebugInfo* info
- );
- /************************************************************************/
- /* ENCODER */
- /************************************************************************/
- extern RetCode ProductVpuEncUpdateBitstreamBuffer(
- CodecInst* instance,
- Int32 size
- );
- extern RetCode ProductVpuEncGetRdWrPtr(
- CodecInst* instance,
- PhysicalAddress* rdPtr,
- PhysicalAddress* wrPtr
- );
- extern RetCode ProductVpuEncBuildUpOpenParam(
- CodecInst* pCodec,
- EncOpenParam* param
- );
- extern RetCode ProductVpuEncFiniSeq(
- CodecInst* instance
- );
- extern RetCode ProductCheckEncOpenParam(
- EncOpenParam* param
- );
- extern RetCode ProductVpuEncSetup(
- CodecInst* instance
- );
- extern RetCode ProductVpuEncode(
- CodecInst* instance,
- EncParam* param
- );
- extern RetCode ProductVpuEncGetResult(
- CodecInst* instance,
- EncOutputInfo* result
- );
- extern RetCode ProductVpuEncGiveCommand(
- CodecInst* instance,
- CodecCommand cmd,
- void* param);
- extern RetCode ProductVpuEncInitSeq(
- CodecInst* instance
- );
- extern RetCode ProductVpuEncGetSeqInfo(
- CodecInst* instance,
- EncInitialInfo* info
- );
- extern RetCode ProductVpuGetSrcBufFlag(
- CodecInst* instance,
- Uint32* data
- );
- #ifdef __cplusplus
- };
- #endif /* __cplusplus */
- #endif /* __VPUAPI_PRODUCT_ABSTRACT_H__ */
-
|