From 4ab8c88e98020363b45884599eef2539a530969e Mon Sep 17 00:00:00 2001 From: huili2 Date: Mon, 14 Apr 2014 20:08:25 -0700 Subject: [PATCH] divide copy_mb functions into new file for decoder use from encoder and add files for EC in decoder only. --- codec/build/win32/dec/WelsDecCore.vcproj | 16 +++ codec/build/win32/enc/WelsEncCore.vcproj | 8 ++ codec/common/inc/copy_mb.h | 72 +++++++++++++ codec/common/src/copy_mb.cpp | 103 +++++++++++++++++++ codec/common/targets.mk | 1 + codec/decoder/core/inc/decoder_context.h | 9 ++ codec/decoder/core/inc/error_concealment.h | 62 +++++++++++ codec/decoder/core/src/decoder.cpp | 10 +- codec/decoder/core/src/decoder_core.cpp | 2 + codec/decoder/core/src/error_concealment.cpp | 98 ++++++++++++++++++ codec/decoder/targets.mk | 1 + codec/encoder/core/inc/encode_mb_aux.h | 25 +---- codec/encoder/core/src/encode_mb_aux.cpp | 59 ----------- 13 files changed, 380 insertions(+), 86 deletions(-) create mode 100644 codec/common/inc/copy_mb.h create mode 100644 codec/common/src/copy_mb.cpp create mode 100644 codec/decoder/core/inc/error_concealment.h create mode 100644 codec/decoder/core/src/error_concealment.cpp diff --git a/codec/build/win32/dec/WelsDecCore.vcproj b/codec/build/win32/dec/WelsDecCore.vcproj index 85d8d261..c65c1273 100644 --- a/codec/build/win32/dec/WelsDecCore.vcproj +++ b/codec/build/win32/dec/WelsDecCore.vcproj @@ -685,6 +685,10 @@ RelativePath="..\..\..\decoder\core\inc\bit_stream.h" > + + @@ -733,6 +737,10 @@ RelativePath="..\..\..\decoder\core\inc\error_code.h" > + + @@ -854,6 +862,10 @@ RelativePath="..\..\..\decoder\core\src\bit_stream.cpp" > + + @@ -890,6 +902,10 @@ RelativePath="..\..\..\decoder\core\src\decoder_data_tables.cpp" > + + diff --git a/codec/build/win32/enc/WelsEncCore.vcproj b/codec/build/win32/enc/WelsEncCore.vcproj index c59a241d..4e140f80 100644 --- a/codec/build/win32/enc/WelsEncCore.vcproj +++ b/codec/build/win32/enc/WelsEncCore.vcproj @@ -395,6 +395,10 @@ /> + + @@ -1448,6 +1452,10 @@ RelativePath="..\..\..\encoder\core\inc\bit_stream.h" > + + diff --git a/codec/common/inc/copy_mb.h b/codec/common/inc/copy_mb.h new file mode 100644 index 00000000..0a94b083 --- /dev/null +++ b/codec/common/inc/copy_mb.h @@ -0,0 +1,72 @@ +/*! + * \copy + * Copyright (c) 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. + * + */ + +#ifndef WELS_COPY_MB_H_ +#define WELS_COPY_MB_H_ + +#include "typedefs.h" + +/**************************************************************************** + * Copy functions + ****************************************************************************/ +void WelsCopy4x4 (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy8x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy8x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); // +void WelsCopy16x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); // +void WelsCopy16x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); + +#if defined(__cplusplus) +extern "C" { +#endif//__cplusplus + +#if defined (X86_ASM) + +void WelsCopy8x8_mmx (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy8x16_mmx (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy16x8NotAligned_sse2 (uint8_t* Dst, int32_t iStrideD, uint8_t* Src, int32_t iStrideS); +void WelsCopy16x16_sse2 (uint8_t* Dst, int32_t iStrideD, uint8_t* Src, int32_t iStrideS); +void WelsCopy16x16NotAligned_sse2 (uint8_t* Dst, int32_t iStrideD, uint8_t* Src, int32_t iStrideS); +#endif//X86_ASM + +#if defined (HAVE_NEON) +void WelsCopy8x8_neon (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy16x16_neon (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy16x16NotAligned_neon (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy16x8NotAligned_neon (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +void WelsCopy8x16_neon (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +#endif + +#if defined(__cplusplus) +} +#endif//__cplusplus + +#endif //SAMPLE_H_ diff --git a/codec/common/src/copy_mb.cpp b/codec/common/src/copy_mb.cpp new file mode 100644 index 00000000..5d338b8d --- /dev/null +++ b/codec/common/src/copy_mb.cpp @@ -0,0 +1,103 @@ +/*! + * \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. + * + * + * \file copy_mb.cpp + * + * \brief copy MB YUV data + * + * \date 2014.04.14 Created + * + ************************************************************************************* + */ + +#include "copy_mb.h" +#include "macros.h" +#include "ls_defines.h" + +/**************************************************************************** + * Copy functions + ****************************************************************************/ +void WelsCopy4x4 (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { + const int32_t kiSrcStride2 = iStrideS << 1; + const int32_t kiSrcStride3 = iStrideS + kiSrcStride2; + const int32_t kiDstStride2 = iStrideD << 1; + const int32_t kiDstStride3 = iStrideD + kiDstStride2; + + ST32 (pDst, LD32 (pSrc)); + ST32 (pDst + iStrideD, LD32 (pSrc + iStrideS)); + ST32 (pDst + kiDstStride2, LD32 (pSrc + kiSrcStride2)); + ST32 (pDst + kiDstStride3, LD32 (pSrc + kiSrcStride3)); +} +void WelsCopy8x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { + int32_t i; + for (i = 0; i < 4; i++) { + ST32 (pDst, LD32 (pSrc)); + ST32 (pDst + 4 , LD32 (pSrc + 4)); + ST32 (pDst + iStrideD, LD32 (pSrc + iStrideS)); + ST32 (pDst + iStrideD + 4 , LD32 (pSrc + iStrideS + 4)); + pDst += iStrideD << 1; + pSrc += iStrideS << 1; + } +} +void WelsCopy8x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { + int32_t i; + for (i = 0; i < 8; ++i) { + ST32 (pDst, LD32 (pSrc)); + ST32 (pDst + 4 , LD32 (pSrc + 4)); + ST32 (pDst + iStrideD, LD32 (pSrc + iStrideS)); + ST32 (pDst + iStrideD + 4 , LD32 (pSrc + iStrideS + 4)); + pDst += iStrideD << 1; + pSrc += iStrideS << 1; + } +} +void WelsCopy16x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { + int32_t i; + for (i = 0; i < 8; i++) { + ST32 (pDst, LD32 (pSrc)); + ST32 (pDst + 4 , LD32 (pSrc + 4)); + ST32 (pDst + 8 , LD32 (pSrc + 8)); + ST32 (pDst + 12 , LD32 (pSrc + 12)); + pDst += iStrideD ; + pSrc += iStrideS; + } +} +void WelsCopy16x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { + int32_t i; + for (i = 0; i < 16; i++) { + ST32 (pDst, LD32 (pSrc)); + ST32 (pDst + 4 , LD32 (pSrc + 4)); + ST32 (pDst + 8 , LD32 (pSrc + 8)); + ST32 (pDst + 12 , LD32 (pSrc + 12)); + pDst += iStrideD ; + pSrc += iStrideS; + } +} + diff --git a/codec/common/targets.mk b/codec/common/targets.mk index ab31e60c..20c0535f 100644 --- a/codec/common/targets.mk +++ b/codec/common/targets.mk @@ -1,5 +1,6 @@ COMMON_SRCDIR=codec/common COMMON_CPP_SRCS=\ + $(COMMON_SRCDIR)/src/copy_mb.cpp\ $(COMMON_SRCDIR)/src/cpu.cpp\ $(COMMON_SRCDIR)/src/crt_util_safe_x.cpp\ $(COMMON_SRCDIR)/src/deblocking_common.cpp\ diff --git a/codec/decoder/core/inc/decoder_context.h b/codec/decoder/core/inc/decoder_context.h index aef80adc..cef857f2 100644 --- a/codec/decoder/core/inc/decoder_context.h +++ b/codec/decoder/core/inc/decoder_context.h @@ -98,6 +98,12 @@ typedef struct TagMcFunc { PWelsMcFunc pMcChromaFunc; } SMcFunc; +typedef void (*PCopyFunc) (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); +typedef struct TagCopyFunc { + PCopyFunc pCopyLumaFunc; + PCopyFunc pCopyChromaFunc; +} SCopyFunc; + //deblock module defination struct TagDeblockingFunc; @@ -279,6 +285,9 @@ typedef struct TagWelsDecoderContext { PGetIntraPredFunc pGetIChromaPredFunc[7]; // h264_predict_8x8_t PIdctResAddPredFunc pIdctResAddPredFunc; SMcFunc sMcFunc; + + //For error concealment + SCopyFunc sCopyFunc; /* For Deblocking */ SDeblockingFunc sDeblockingFunc; SExpandPicFunc sExpandPicFunc; diff --git a/codec/decoder/core/inc/error_concealment.h b/codec/decoder/core/inc/error_concealment.h new file mode 100644 index 00000000..dbfe8ada --- /dev/null +++ b/codec/decoder/core/inc/error_concealment.h @@ -0,0 +1,62 @@ +/*! + * \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. + * + * \file error_concealment.h + * + * \brief Interfaces introduced for error concealment + * + * \date 04/14/2014 Created + * + ************************************************************************************* + */ +#ifndef WELS_ERROR_CONCEALMENT_H__ +#define WELS_ERROR_CONCEALMENT_H__ +#include "typedefs.h" +#include "decoder_context.h" + +namespace WelsDec { +//Initialize error concealment +void InitErrorCon (PWelsDecoderContext pCtx); +//Do error concealment using frame copy method +void DoErrorConFrameCopy (PWelsDecoderContext pCtx); +//Do error concealment using slice copy method +void DoErrorConSliceCopy (PWelsDecoderContext pCtx); +//Mark erroneous frame as Ref Pic into DPB +int32_t MarkECFrameAsRef (PWelsDecoderContext pCtx); +//Judge if EC is needed to current frame +bool NeedErrorCon (PWelsDecoderContext pCtx); +// ImplementErrorConceal +// Do actual error concealment +int32_t ImplementErrorCon (PWelsDecoderContext pCtx); + +} // namespace WelsDec + +#endif//WELS_ERROR_CONCEALMENT_H__ + diff --git a/codec/decoder/core/src/decoder.cpp b/codec/decoder/core/src/decoder.cpp index 4cd58771..3f7806f2 100644 --- a/codec/decoder/core/src/decoder.cpp +++ b/codec/decoder/core/src/decoder.cpp @@ -50,6 +50,7 @@ #include "deblocking.h" #include "expand_pic.h" #include "decode_slice.h" +#include "error_concealment.h" #include "mem_align.h" #include "ls_defines.h" @@ -476,6 +477,8 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in return pCtx->iErrorCode; } } + //Do error concealment here + ImplementErrorCon (pCtx); } if ((IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) || IS_SEI_NAL (pCtx->sCurNalHead.eNalUnitType)) && @@ -530,10 +533,10 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in ResetParameterSetsState (pCtx); return pCtx->iErrorCode; } + //Do error concealment here + ImplementErrorCon (pCtx); } - //TODO error concealment here - if ((IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) || IS_SEI_NAL (pCtx->sCurNalHead.eNalUnitType)) && pNalPayload) { if (ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes)) { @@ -571,7 +574,8 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in ResetParameterSetsState (pCtx); return pCtx->iErrorCode; } - + //Do error concealment here + ImplementErrorCon (pCtx); } } diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp index b069002f..4f487bd6 100644 --- a/codec/decoder/core/src/decoder_core.cpp +++ b/codec/decoder/core/src/decoder_core.cpp @@ -41,6 +41,7 @@ #include "decoder.h" #include "decode_mb_aux.h" #include "mem_align.h" +#include "error_concealment.h" namespace WelsDec { @@ -1506,6 +1507,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI WelsLog (pCtx, WELS_LOG_WARNING, "sync picture resolution ext failed, the error is %d", iErr); return iErr; } + InitErrorCon (pCtx); //Do EC initialization here, for sequence start } diff --git a/codec/decoder/core/src/error_concealment.cpp b/codec/decoder/core/src/error_concealment.cpp new file mode 100644 index 00000000..c6a4d6e6 --- /dev/null +++ b/codec/decoder/core/src/error_concealment.cpp @@ -0,0 +1,98 @@ +/*! + * \copy + * Copyright (c) 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. + * + * error_concealment.cpp: Wels decoder error concealment implementation + */ + +#include "error_code.h" +#include "expand_pic.h" +#include "manage_dec_ref.h" +#include "copy_mb.h" +#include "error_concealment.h" +#include "cpu_core.h" + +namespace WelsDec { +//Init +void InitErrorCon (PWelsDecoderContext pCtx) { + if (pCtx->iErrorConMethod == ERROR_CON_SLICE_COPY) { + pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_c; + pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_c; + +#if defined(X86_ASM) + if (pCtx->uiCpuFlag & WELS_CPU_MMXEXT) { + pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_mmx; //aligned + } + + if (pCtx->uiCpuFlag & WELS_CPU_SSE2) { + pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_sse2; //this is aligned copy; + } +#endif //X86_ASM + +#if defined(HAVE_NEON) + if (pCtx->uiCpuFlag & WELS_CPU_NEON) { + pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_neon; //aligned + } +#endif //HAVE_NEON + } //TODO add more methods here + return; +} + +//Do error concealment using frame copy method +void DoErrorConFrameCopy (PWelsDecoderContext pCtx) { + //TODO +} + + +//Do error concealment using slice copy method +void DoErrorConSliceCopy (PWelsDecoderContext pCtx) { + //TODO +} + +//Mark erroneous frame as Ref Pic into DPB +int32_t MarkECFrameAsRef (PWelsDecoderContext pCtx) { + //TODO + return ERR_NONE; +} + +bool NeedErrorCon (PWelsDecoderContext pCtx) { + bool bNeedEC = false; + //TODO + return bNeedEC; +} + +// ImplementErrorConceal +// Do actual error concealment +int32_t ImplementErrorCon (PWelsDecoderContext pCtx) { + int32_t iRet = ERR_NONE; + //TODO + return iRet; +} + +} // namespace WelsDec diff --git a/codec/decoder/targets.mk b/codec/decoder/targets.mk index af757bab..966c2aa8 100644 --- a/codec/decoder/targets.mk +++ b/codec/decoder/targets.mk @@ -8,6 +8,7 @@ DECODER_CPP_SRCS=\ $(DECODER_SRCDIR)/core/src/decoder.cpp\ $(DECODER_SRCDIR)/core/src/decoder_core.cpp\ $(DECODER_SRCDIR)/core/src/decoder_data_tables.cpp\ + $(DECODER_SRCDIR)/core/src/error_concealment.cpp\ $(DECODER_SRCDIR)/core/src/expand_pic.cpp\ $(DECODER_SRCDIR)/core/src/fmo.cpp\ $(DECODER_SRCDIR)/core/src/get_intra_predictor.cpp\ diff --git a/codec/encoder/core/inc/encode_mb_aux.h b/codec/encoder/core/inc/encode_mb_aux.h index 47f0e8ab..8b9dc28d 100644 --- a/codec/encoder/core/inc/encode_mb_aux.h +++ b/codec/encoder/core/inc/encode_mb_aux.h @@ -35,6 +35,7 @@ #include "typedefs.h" #include "wels_func_ptr_def.h" +#include "copy_mb.h" namespace WelsSVCEnc { void WelsInitEncodingFuncs (SWelsFuncPtrList* pFuncList, uint32_t uiCpuFlag); @@ -68,15 +69,6 @@ void WelsDctT4_c (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pP // dct_data is no-use here, just for the same interface with dct_save functions void WelsDctFourT4_c (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); -/**************************************************************************** - * Copy functions - ****************************************************************************/ -void WelsCopy4x4 (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); -void WelsCopy8x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); -void WelsCopy8x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); // -void WelsCopy16x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); // -void WelsCopy16x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); - #if defined(__cplusplus) extern "C" { #endif//__cplusplus @@ -111,24 +103,9 @@ void WelsQuant4x4Dc_sse2 (int16_t* pDct, int16_t iFF, int16_t iMF); void WelsQuantFour4x4_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuantFour4x4Max_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax); - -/**************************************************************************** - * Copy functions for rec - ****************************************************************************/ -void WelsCopy8x8_mmx (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); -void WelsCopy8x16_mmx (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS); -void WelsCopy16x8NotAligned_sse2 (uint8_t* Dst, int32_t iStrideD, uint8_t* Src, int32_t iStrideS); -void WelsCopy16x16_sse2 (uint8_t* Dst, int32_t iStrideD, uint8_t* Src, int32_t iStrideS); -void WelsCopy16x16NotAligned_sse2 (uint8_t* Dst, int32_t iStrideD, uint8_t* Src, int32_t iStrideS); #endif #ifdef HAVE_NEON -void WelsCopy8x8_neon( uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS ); -void WelsCopy16x16_neon( uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS ); -void WelsCopy16x16NotAligned_neon( uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS ); -void WelsCopy16x8NotAligned_neon( uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS ); -void WelsCopy8x16_neon( uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS ); - void WelsHadamardT4Dc_neon(int16_t* pLumaDc, int16_t* pDct); int32_t WelsHadamardQuant2x2_neon(int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct, int16_t* pBlock); int32_t WelsHadamardQuant2x2Skip_neon(int16_t* pRes, int16_t iFF, int16_t iMF); diff --git a/codec/encoder/core/src/encode_mb_aux.cpp b/codec/encoder/core/src/encode_mb_aux.cpp index 258d2248..f42a0367 100644 --- a/codec/encoder/core/src/encode_mb_aux.cpp +++ b/codec/encoder/core/src/encode_mb_aux.cpp @@ -434,65 +434,6 @@ int32_t WelsCalculateSingleCtr4x4_c (int16_t* pDct) { return iSingleCtr; } -/**************************************************************************** - * Copy functions - ****************************************************************************/ -void WelsCopy4x4 (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { - const int32_t kiSrcStride2 = iStrideS << 1; - const int32_t kiSrcStride3 = iStrideS + kiSrcStride2; - const int32_t kiDstStride2 = iStrideD << 1; - const int32_t kiDstStride3 = iStrideD + kiDstStride2; - - ST32 (pDst, LD32 (pSrc)); - ST32 (pDst + iStrideD, LD32 (pSrc + iStrideS)); - ST32 (pDst + kiDstStride2, LD32 (pSrc + kiSrcStride2)); - ST32 (pDst + kiDstStride3, LD32 (pSrc + kiSrcStride3)); -} -void WelsCopy8x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { - int32_t i; - for (i = 0; i < 4; i++) { - ST32 (pDst, LD32 (pSrc)); - ST32 (pDst + 4 , LD32 (pSrc + 4)); - ST32 (pDst + iStrideD, LD32 (pSrc + iStrideS)); - ST32 (pDst + iStrideD + 4 , LD32 (pSrc + iStrideS + 4)); - pDst += iStrideD << 1; - pSrc += iStrideS << 1; - } -} -void WelsCopy8x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { - int32_t i; - for (i = 0; i < 8; ++i) { - ST32 (pDst, LD32 (pSrc)); - ST32 (pDst + 4 , LD32 (pSrc + 4)); - ST32 (pDst + iStrideD, LD32 (pSrc + iStrideS)); - ST32 (pDst + iStrideD + 4 , LD32 (pSrc + iStrideS + 4)); - pDst += iStrideD << 1; - pSrc += iStrideS << 1; - } -} -void WelsCopy16x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { - int32_t i; - for (i = 0; i < 8; i++) { - ST32 (pDst, LD32 (pSrc)); - ST32 (pDst + 4 , LD32 (pSrc + 4)); - ST32 (pDst + 8 , LD32 (pSrc + 8)); - ST32 (pDst + 12 , LD32 (pSrc + 12)); - pDst += iStrideD ; - pSrc += iStrideS; - } -} -void WelsCopy16x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) { - int32_t i; - for (i = 0; i < 16; i++) { - ST32 (pDst, LD32 (pSrc)); - ST32 (pDst + 4 , LD32 (pSrc + 4)); - ST32 (pDst + 8 , LD32 (pSrc + 8)); - ST32 (pDst + 12 , LD32 (pSrc + 12)); - pDst += iStrideD ; - pSrc += iStrideS; - } -} - int32_t WelsGetNoneZeroCount_c (int16_t* pLevel) { int32_t iCnt = 0; int32_t iIdx = 0;