ref: 14e5d740cd3c3b8477c17591221e80a6e7b06753
parent: 78eed44d1523ec28012b0e96ae209993c312c989
author: ruil2 <[email protected]>
date: Fri May 30 07:05:31 EDT 2014
clean up expand picture.
--- a/codec/build/win32/dec/WelsDecCore.vcproj
+++ b/codec/build/win32/dec/WelsDecCore.vcproj
@@ -730,14 +730,10 @@
>
</File>
<File
- RelativePath="..\..\..\decoder\core\inc\expand_pic.h"
+ RelativePath="..\..\..\common\inc\expand_pic.h"
>
</File>
<File
- RelativePath="..\..\..\common\inc\expand_picture_common.h"
- >
- </File>
- <File
RelativePath="..\..\..\decoder\core\inc\fmo.h"
>
</File>
@@ -895,7 +891,7 @@
>
</File>
<File
- RelativePath="..\..\..\decoder\core\src\expand_pic.cpp"
+ RelativePath="..\..\..\common\src\expand_pic.cpp"
>
</File>
<File
--- a/codec/build/win32/enc/WelsEncCore.vcproj
+++ b/codec/build/win32/enc/WelsEncCore.vcproj
@@ -388,7 +388,7 @@
>
</File>
<File
- RelativePath="..\..\..\encoder\core\src\expand_pic.cpp"
+ RelativePath="..\..\..\common\src\expand_pic.cpp"
>
</File>
<File
@@ -545,11 +545,7 @@
>
</File>
<File
- RelativePath="..\..\..\encoder\core\inc\expand_pic.h"
- >
- </File>
- <File
- RelativePath="..\..\..\common\inc\expand_picture_common.h"
+ RelativePath="..\..\..\common\inc\expand_pic.h"
>
</File>
<File
--- /dev/null
+++ b/codec/common/inc/expand_pic.h
@@ -1,0 +1,93 @@
+/*!
+ * \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 expand_pic.h
+ *
+ * \brief Interface for expanding reconstructed picture to be used for reference
+ *
+ * \date 06/08/2009
+ *************************************************************************************
+ */
+
+#ifndef EXPAND_PICTURE_H
+#define EXPAND_PICTURE_H
+
+#include "typedefs.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif//__cplusplus
+
+#define PADDING_LENGTH 32 // reference extension
+
+#if defined(X86_ASM)
+void ExpandPictureLuma_sse2 (uint8_t* pDst,
+ const int32_t kiStride,
+ const int32_t kiPicW,
+ const int32_t kiPicH);
+void ExpandPictureChromaAlign_sse2 (uint8_t* pDst,
+ const int32_t kiStride,
+ const int32_t kiPicW,
+ const int32_t kiPicH);
+void ExpandPictureChromaUnalign_sse2 (uint8_t* pDst,
+ const int32_t kiStride,
+ const int32_t kiPicW,
+ const int32_t kiPicH);
+#endif//X86_ASM
+
+#if defined(HAVE_NEON)
+void ExpandPictureLuma_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
+void ExpandPictureChroma_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
+#endif
+#if defined(HAVE_NEON_AARCH64)
+void ExpandPictureLuma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
+void ExpandPictureChroma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
+ const int32_t kiPicH);
+#endif
+
+typedef void (*PExpandPictureFunc) (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
+
+typedef struct TagExpandPicFunc {
+ PExpandPictureFunc pfExpandLumaPicture;
+ PExpandPictureFunc pfExpandChromaPicture[2];
+} SExpandPicFunc;
+
+
+void ExpandReferencingPicture (uint8_t* pData[3], int32_t iWidth, int32_t iHeight, int32_t iStride[3],
+ PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChrom[2]);
+
+void InitExpandPictureFunc (SExpandPicFunc* pExpandPicFunc, const uint32_t kuiCPUFlags);
+
+#if defined(__cplusplus)
+}
+#endif//__cplusplus
+
+#endif
--- a/codec/common/inc/expand_picture_common.h
+++ /dev/null
@@ -1,77 +1,0 @@
-/*!
- * \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 expand_pic.h
- *
- * \brief Interface for expanding reconstructed picture to be used for reference
- *
- * \date 06/08/2009
- *************************************************************************************
- */
-
-#ifndef EXPAND_PICTURE_COMMON_H
-#define EXPAND_PICTURE_COMMON_H
-
-#include "typedefs.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#endif//__cplusplus
-
-#if defined(X86_ASM)
-void ExpandPictureLuma_sse2 (uint8_t* pDst,
- const int32_t kiStride,
- const int32_t kiPicW,
- const int32_t kiPicH);
-void ExpandPictureChromaAlign_sse2 (uint8_t* pDst,
- const int32_t kiStride,
- const int32_t kiPicW,
- const int32_t kiPicH);
-void ExpandPictureChromaUnalign_sse2 (uint8_t* pDst,
- const int32_t kiStride,
- const int32_t kiPicW,
- const int32_t kiPicH);
-#endif//X86_ASM
-
-#if defined(HAVE_NEON)
-void ExpandPictureLuma_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
-void ExpandPictureChroma_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
-#endif
-#if defined(HAVE_NEON_AARCH64)
-void ExpandPictureLuma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
-void ExpandPictureChroma_AArch64_neon (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
- const int32_t kiPicH);
-#endif
-#if defined(__cplusplus)
-}
-#endif//__cplusplus
-
-#endif
--- /dev/null
+++ b/codec/common/src/expand_pic.cpp
@@ -1,0 +1,174 @@
+/*!
+ * \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.
+ *
+ */
+#include <string.h>
+#include "expand_pic.h"
+#include "cpu_core.h"
+
+// rewrite it (split into luma & chroma) that is helpful for mmx/sse2 optimization perform, 9/27/2009
+static inline void ExpandPictureLuma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
+ const int32_t kiPicH) {
+ uint8_t* pTmp = pDst;
+ uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
+ const int32_t kiPaddingLen = PADDING_LENGTH;
+ const uint8_t kuiTL = pTmp[0];
+ const uint8_t kuiTR = pTmp[kiPicW - 1];
+ const uint8_t kuiBL = pDstLastLine[0];
+ const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
+ int32_t i = 0;
+
+ do {
+ const int32_t kiStrides = (1 + i) * kiStride;
+ uint8_t* pTop = pTmp - kiStrides;
+ uint8_t* pBottom = pDstLastLine + kiStrides;
+
+ // pad pTop and pBottom
+ memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
+ memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
+
+ // pad corners
+ memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
+ memset (pTop + kiPicW, kuiTR, kiPaddingLen); //pTop right
+ memset (pBottom - kiPaddingLen, kuiBL, kiPaddingLen); //pBottom left
+ memset (pBottom + kiPicW, kuiBR, kiPaddingLen); //pBottom right
+
+ ++ i;
+ } while (i < kiPaddingLen);
+
+ // pad left and right
+ i = 0;
+ do {
+ memset (pTmp - kiPaddingLen, pTmp[0], kiPaddingLen);
+ memset (pTmp + kiPicW, pTmp[kiPicW - 1], kiPaddingLen);
+
+ pTmp += kiStride;
+ ++ i;
+ } while (i < kiPicH);
+}
+
+static inline void ExpandPictureChroma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
+ const int32_t kiPicH) {
+ uint8_t* pTmp = pDst;
+ uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
+ const int32_t kiPaddingLen = (PADDING_LENGTH >> 1);
+ const uint8_t kuiTL = pTmp[0];
+ const uint8_t kuiTR = pTmp[kiPicW - 1];
+ const uint8_t kuiBL = pDstLastLine[0];
+ const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
+ int32_t i = 0;
+
+ do {
+ const int32_t kiStrides = (1 + i) * kiStride;
+ uint8_t* pTop = pTmp - kiStrides;
+ uint8_t* pBottom = pDstLastLine + kiStrides;
+
+ // pad pTop and pBottom
+ memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
+ memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
+
+ // pad corners
+ memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
+ memset (pTop + kiPicW, kuiTR, kiPaddingLen); //pTop right
+ memset (pBottom - kiPaddingLen, kuiBL, kiPaddingLen); //pBottom left
+ memset (pBottom + kiPicW, kuiBR, kiPaddingLen); //pBottom right
+
+ ++ i;
+ } while (i < kiPaddingLen);
+
+ // pad left and right
+ i = 0;
+ do {
+ memset (pTmp - kiPaddingLen, pTmp[0], kiPaddingLen);
+ memset (pTmp + kiPicW, pTmp[kiPicW - 1], kiPaddingLen);
+
+ pTmp += kiStride;
+ ++ i;
+ } while (i < kiPicH);
+}
+
+void InitExpandPictureFunc (SExpandPicFunc* pExpandPicFunc, const uint32_t kuiCPUFlag) {
+ pExpandPicFunc->pfExpandLumaPicture = ExpandPictureLuma_c;
+ pExpandPicFunc->pfExpandChromaPicture[0] = ExpandPictureChroma_c;
+ pExpandPicFunc->pfExpandChromaPicture[1] = ExpandPictureChroma_c;
+
+#if defined(X86_ASM)
+ if ((kuiCPUFlag & WELS_CPU_SSE2) == WELS_CPU_SSE2) {
+ pExpandPicFunc->pfExpandLumaPicture = ExpandPictureLuma_sse2;
+ pExpandPicFunc->pfExpandChromaPicture[0] = ExpandPictureChromaUnalign_sse2;
+ pExpandPicFunc->pfExpandChromaPicture[1] = ExpandPictureChromaAlign_sse2;
+ }
+#endif//X86_ASM
+#if defined(HAVE_NEON)
+ if (kuiCPUFlag & WELS_CPU_NEON) {
+ pExpandPicFunc->pfExpandLumaPicture = ExpandPictureLuma_neon;
+ pExpandPicFunc->pfExpandChromaPicture[0] = ExpandPictureChroma_neon;
+ pExpandPicFunc->pfExpandChromaPicture[1] = ExpandPictureChroma_neon;
+ }
+#endif//HAVE_NEON
+#if defined(HAVE_NEON_AARCH64)
+ if (kuiCPUFlag & WELS_CPU_NEON) {
+ pExpandPicFunc->pfExpandLumaPicture = ExpandPictureLuma_AArch64_neon;
+ pExpandPicFunc->pfExpandChromaPicture[0] = ExpandPictureChroma_AArch64_neon;
+ pExpandPicFunc->pfExpandChromaPicture[1] = ExpandPictureChroma_AArch64_neon;
+ }
+#endif//HAVE_NEON_AARCH64
+}
+
+
+//void ExpandReferencingPicture (SPicture* pPic, PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChrom[2]) {
+void ExpandReferencingPicture (uint8_t* pData[3], int32_t iWidth, int32_t iHeight, int32_t iStride[3],
+ PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChrom[2]) {
+ /*local variable*/
+ uint8_t* pPicY = pData[0];
+ uint8_t* pPicCb = pData[1];
+ uint8_t* pPicCr = pData[2];
+ const int32_t kiWidthY = iWidth;
+ const int32_t kiHeightY = iHeight;
+ const int32_t kiWidthUV = kiWidthY >> 1;
+ const int32_t kiHeightUV = kiHeightY >> 1;
+
+
+
+ pExpLuma (pPicY, iStride[0], kiWidthY, kiHeightY);
+ if (kiWidthUV >= 16) {
+ // fix coding picture size as 16x16
+ const bool kbChrAligned = /*(iWidthUV >= 16) && */ ((kiWidthUV & 0x0F) == 0); // chroma planes: (16+iWidthUV) & 15
+ pExpChrom[kbChrAligned] (pPicCb, iStride[1], kiWidthUV, kiHeightUV);
+ pExpChrom[kbChrAligned] (pPicCr, iStride[2], kiWidthUV, kiHeightUV);
+ } else {
+ // fix coding picture size as 16x16
+ ExpandPictureChroma_c (pPicCb, iStride[1], kiWidthUV, kiHeightUV);
+ ExpandPictureChroma_c (pPicCr, iStride[2], kiWidthUV, kiHeightUV);
+ }
+
+
+
+}
--- a/codec/common/targets.mk
+++ b/codec/common/targets.mk
@@ -4,6 +4,7 @@
$(COMMON_SRCDIR)/src/cpu.cpp\
$(COMMON_SRCDIR)/src/crt_util_safe_x.cpp\
$(COMMON_SRCDIR)/src/deblocking_common.cpp\
+ $(COMMON_SRCDIR)/src/expand_pic.cpp\
$(COMMON_SRCDIR)/src/logging.cpp\
$(COMMON_SRCDIR)/src/sad_common.cpp\
$(COMMON_SRCDIR)/src/WelsThreadLib.cpp\
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -53,6 +53,7 @@
#include "as264_common.h" // for LONG_TERM_REF macro,can be delete if not need this macro
#include "crt_util_safe_x.h"
#include "mb_cache.h"
+#include "expand_pic.h"
namespace WelsDec {
@@ -150,11 +151,6 @@
typedef int32_t (*PWelsParseIntra4x4ModeFunc) (PNeighAvail pNeighAvail, int8_t* pIntraPredMode, PBitStringAux pBs,
PDqLayer pCurDqLayer);
typedef int32_t (*PWelsParseIntra16x16ModeFunc) (PNeighAvail pNeighAvail, PBitStringAux pBs, PDqLayer pCurDqLayer);
-
-typedef struct TagExpandPicFunc {
- PExpandPictureFunc pExpandLumaPicture;
- PExpandPictureFunc pExpandChromaPicture[2];
-} SExpandPicFunc;
enum {
OVERWRITE_NONE = 0,
--- a/codec/decoder/core/inc/expand_pic.h
+++ /dev/null
@@ -1,57 +1,0 @@
-/*!
- * \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 expand_pic.h
- *
- * \brief Interface for expanding reconstructed picture to be used for reference
- *
- * \date 06/08/2009 Created
- *************************************************************************************
- */
-
-#ifndef WELS_EXPAND_PIC_H__
-#define WELS_EXPAND_PIC_H__
-
-#include "decoder_context.h"
-#include "picture.h"
-
-#include "expand_picture_common.h"
-
-namespace WelsDec {
-
-void ExpandReferencingPicture (PPicture pPic, PExpandPictureFunc pExpandPictureLuma,
- PExpandPictureFunc pExpandPictureChroma[2]);
-
-void InitExpandPictureFunc (SExpandPicFunc* pExpandPicFunc, const uint32_t kuiCpuFlags);
-
-} // namespace WelsDec
-
-#endif//WELS_EXPAND_PIC_H__
--- a/codec/decoder/core/inc/wels_const.h
+++ b/codec/decoder/core/inc/wels_const.h
@@ -81,7 +81,6 @@
#define ALIGN_RBSP_LEN_FIX 4
-#define PADDING_LENGTH 32 // reference extension
#define BASE_QUALITY_ID 0
//#define BASE_DEPENDENCY_ID 0
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -1919,8 +1919,9 @@
return iRet;
}
}
- ExpandReferencingPicture (pCtx->pDec, pCtx->sExpandPicFunc.pExpandLumaPicture,
- pCtx->sExpandPicFunc.pExpandChromaPicture);
+ ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
+ pCtx->pDec->iLinesize,
+ pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
pCtx->pDec = NULL;
}
}
--- a/codec/decoder/core/src/error_concealment.cpp
+++ b/codec/decoder/core/src/error_concealment.cpp
@@ -149,8 +149,9 @@
pCtx->pDec = NULL;
return iRet;
}
- ExpandReferencingPicture (pCtx->pDec, pCtx->sExpandPicFunc.pExpandLumaPicture,
- pCtx->sExpandPicFunc.pExpandChromaPicture);
+ ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
+ pCtx->pDec->iLinesize,
+ pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
pCtx->pDec = NULL;
return ERR_NONE;
--- a/codec/decoder/core/src/expand_pic.cpp
+++ /dev/null
@@ -1,171 +1,0 @@
-/*!
- * \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.
- *
- */
-
-
-#include "expand_pic.h"
-#include "cpu_core.h"
-
-namespace WelsDec {
-
-// rewrite it (split into luma & chroma) that is helpful for mmx/sse2 optimization perform, 9/27/2009
-static inline void ExpandPictureLuma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicWidth,
- const int32_t kiPicHeight) {
- uint8_t* pTmp = pDst;
- uint8_t* pDstLastLine = pTmp + (kiPicHeight - 1) * kiStride;
- const int32_t kiPaddingLen = PADDING_LENGTH;
- const uint8_t kuiTopLeft = pTmp[0];
- const uint8_t kuiTopRight = pTmp[kiPicWidth - 1];
- const uint8_t kuiBottomLeft = pDstLastLine[0];
- const uint8_t kuiBottomRight = pDstLastLine[kiPicWidth - 1];
- int32_t i = 0;
-
- do {
- const int32_t kiStrides = (1 + i) * kiStride;
- uint8_t* pTop = pTmp - kiStrides;
- uint8_t* pBottom = pDstLastLine + kiStrides;
-
- // pad pTop and pBottom
- memcpy (pTop, pTmp, kiPicWidth);
- memcpy (pBottom, pDstLastLine, kiPicWidth);
-
- // pad corners
- memset (pTop - kiPaddingLen, kuiTopLeft, kiPaddingLen); //pTop left
- memset (pTop + kiPicWidth, kuiTopRight, kiPaddingLen); //pTop right
- memset (pBottom - kiPaddingLen, kuiBottomLeft, kiPaddingLen); //pBottom left
- memset (pBottom + kiPicWidth, kuiBottomRight, kiPaddingLen); //pBottom right
-
- ++ i;
- } while (i < kiPaddingLen);
-
- // pad left and right
- i = 0;
- do {
- memset (pTmp - kiPaddingLen, pTmp[0], kiPaddingLen);
- memset (pTmp + kiPicWidth, pTmp[kiPicWidth - 1], kiPaddingLen);
-
- pTmp += kiStride;
- ++ i;
- } while (i < kiPicHeight);
-}
-
-static inline void ExpandPictureChroma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicWidth,
- const int32_t kiPicHeight) {
- uint8_t* pTmp = pDst;
- uint8_t* pDstLastLine = pTmp + (kiPicHeight - 1) * kiStride;
- const int32_t kiPaddingLen = (PADDING_LENGTH >> 1);
- const uint8_t kuiTopLeft = pTmp[0];
- const uint8_t kuiTopRight = pTmp[kiPicWidth - 1];
- const uint8_t kuiBottomLeft = pDstLastLine[0];
- const uint8_t kuiBottomRight = pDstLastLine[kiPicWidth - 1];
- int32_t i = 0;
-
- do {
- const int32_t kiStrides = (1 + i) * kiStride;
- uint8_t* pTop = pTmp - kiStrides;
- uint8_t* pBottom = pDstLastLine + kiStrides;
-
- // pad pTop and pBottom
- memcpy (pTop, pTmp, kiPicWidth);
- memcpy (pBottom, pDstLastLine, kiPicWidth);
-
- // pad corners
- memset (pTop - kiPaddingLen, kuiTopLeft, kiPaddingLen); //pTop left
- memset (pTop + kiPicWidth, kuiTopRight, kiPaddingLen); //pTop right
- memset (pBottom - kiPaddingLen, kuiBottomLeft, kiPaddingLen); //pBottom left
- memset (pBottom + kiPicWidth, kuiBottomRight, kiPaddingLen); //pBottom right
-
- ++ i;
- } while (i < kiPaddingLen);
-
- // pad left and right
- i = 0;
- do {
- memset (pTmp - kiPaddingLen, pTmp[0], kiPaddingLen);
- memset (pTmp + kiPicWidth, pTmp[kiPicWidth - 1], kiPaddingLen);
-
- pTmp += kiStride;
- ++ i;
- } while (i < kiPicHeight);
-}
-
-void InitExpandPictureFunc (SExpandPicFunc* pExpandPicFunc, const uint32_t kuiCpuFlags) {
- pExpandPicFunc->pExpandLumaPicture = ExpandPictureLuma_c;
- pExpandPicFunc->pExpandChromaPicture[0] = ExpandPictureChroma_c;
- pExpandPicFunc->pExpandChromaPicture[1] = ExpandPictureChroma_c;
-
-#if defined(X86_ASM)
- if ((kuiCpuFlags & WELS_CPU_SSE2) == WELS_CPU_SSE2) {
- pExpandPicFunc->pExpandLumaPicture = ExpandPictureLuma_sse2;
- pExpandPicFunc->pExpandChromaPicture[0] = ExpandPictureChromaUnalign_sse2;
- pExpandPicFunc->pExpandChromaPicture[1] = ExpandPictureChromaAlign_sse2;
- }
-#endif//X86_ASM
-#if defined(HAVE_NEON)
- if ((kuiCpuFlags & WELS_CPU_NEON) == WELS_CPU_NEON) {
- pExpandPicFunc->pExpandLumaPicture = ExpandPictureLuma_neon;
- pExpandPicFunc->pExpandChromaPicture[0] = ExpandPictureChroma_neon;
- pExpandPicFunc->pExpandChromaPicture[1] = ExpandPictureChroma_neon;
- }
-#endif//HAVE_NEON
-#if defined(HAVE_NEON_AARCH64)
- if ((kuiCpuFlags & WELS_CPU_NEON) == WELS_CPU_NEON) {
- pExpandPicFunc->pExpandLumaPicture = ExpandPictureLuma_AArch64_neon;
- pExpandPicFunc->pExpandChromaPicture[0] = ExpandPictureChroma_AArch64_neon;
- pExpandPicFunc->pExpandChromaPicture[1] = ExpandPictureChroma_AArch64_neon;
- }
-#endif//HAVE_NEON_AARCH64
-}
-
-void ExpandReferencingPicture (PPicture pPic, PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChroma[2]) {
- /*local variable*/
- uint8_t* pPicY = pPic->pData[0];
- uint8_t* pPicCb = pPic->pData[1];
- uint8_t* pPicCr = pPic->pData[2];
- const int32_t kiWidthY = pPic->iWidthInPixel;
- const int32_t kiHeightY = pPic->iHeightInPixel;
- const int32_t kiWidthUV = kiWidthY >> 1;
- const int32_t kiHeightUV = kiHeightY >> 1;
-
- pExpLuma (pPicY, pPic->iLinesize[0], kiWidthY, kiHeightY);
- if (kiWidthUV >= 16) {
- // fix coding picture size as 16x16 issues 7/27/2010
- const bool kbChrAligned = /*(kiWidthUV >= 16) && */ ((kiWidthUV & 0x0F) == 0); // chroma planes: (16+kiWidthUV) & 15
- pExpChroma[kbChrAligned] (pPicCb, pPic->iLinesize[1], kiWidthUV, kiHeightUV);
- pExpChroma[kbChrAligned] (pPicCr, pPic->iLinesize[2], kiWidthUV, kiHeightUV);
- } else {
- // fix coding picture size as 16x16 issues 7/27/2010
- ExpandPictureChroma_c (pPicCb, pPic->iLinesize[1], kiWidthUV, kiHeightUV);
- ExpandPictureChroma_c (pPicCr, pPic->iLinesize[2], kiWidthUV, kiHeightUV);
- }
-}
-
-} // namespace WelsDec
--- a/codec/decoder/targets.mk
+++ b/codec/decoder/targets.mk
@@ -9,7 +9,6 @@
$(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\
$(DECODER_SRCDIR)/core/src/manage_dec_ref.cpp\
--- a/codec/encoder/core/inc/expand_pic.h
+++ /dev/null
@@ -1,55 +1,0 @@
-/*!
- * \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 expand_pic.h
- *
- * \brief Interface for expanding reconstructed picture to be used for reference
- *
- * \date 06/08/2009
- *************************************************************************************
- */
-
-#ifndef EXPAND_PIC_H
-#define EXPAND_PIC_H
-
-#include "typedefs.h"
-#include "picture.h"
-
-#include "expand_picture_common.h"
-
-namespace WelsSVCEnc {
-typedef void (*PExpandPictureFunc) (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW, const int32_t kiPicH);
-
-void ExpandReferencingPicture (SPicture* pPic, PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChrom[2]);
-
-void InitExpandPictureFunc (void* pL, const uint32_t kuiCPUFlags);
-}
-#endif
--- a/codec/encoder/core/inc/wels_const.h
+++ b/codec/encoder/core/inc/wels_const.h
@@ -103,7 +103,7 @@
#define ALIGN_RBSP_LEN_FIX 4
-#define PADDING_LENGTH 32 // reference extension
+
#define INTPEL_NEEDED_MARGIN (3) // for safe sub-pel MC
#define I420_PLANES 3
--- a/codec/encoder/core/inc/wels_func_ptr_def.h
+++ b/codec/encoder/core/inc/wels_func_ptr_def.h
@@ -192,10 +192,7 @@
typedef bool (*PUpdateRefListFunc) (void* pCtx);
struct TagWelsFuncPointerList {
- PExpandPictureFunc pfExpandLumaPicture;
- PExpandPictureFunc
- pfExpandChromaPicture[2];// 0: for chroma unalignment && width_uv >= 16; 1: for chroma alignment && width_uv >= 16;
-
+ SExpandPicFunc sExpandPicFunc;
PFillInterNeighborCacheFunc pfFillInterNeighborCache;
PGetVarianceFromIntraVaaFunc pfGetVarianceFromIntraVaa;
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -178,7 +178,7 @@
}
#endif
- InitExpandPictureFunc (pFuncList, uiCpuFlag);
+ InitExpandPictureFunc (& (pFuncList->sExpandPicFunc), uiCpuFlag);
/* Intra_Prediction_fn*/
WelsInitFillingPredFuncs (uiCpuFlag);
--- a/codec/encoder/core/src/expand_pic.cpp
+++ /dev/null
@@ -1,175 +1,0 @@
-/*!
- * \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.
- *
- */
-#include <string.h>
-#include "expand_pic.h"
-#include "cpu_core.h"
-#include "wels_func_ptr_def.h"
-
-namespace WelsSVCEnc {
-// rewrite it (split into luma & chroma) that is helpful for mmx/sse2 optimization perform, 9/27/2009
-static inline void ExpandPictureLuma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
- const int32_t kiPicH) {
- uint8_t* pTmp = pDst;
- uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
- const int32_t kiPaddingLen = PADDING_LENGTH;
- const uint8_t kuiTL = pTmp[0];
- const uint8_t kuiTR = pTmp[kiPicW - 1];
- const uint8_t kuiBL = pDstLastLine[0];
- const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
- int32_t i = 0;
-
- do {
- const int32_t kiStrides = (1 + i) * kiStride;
- uint8_t* pTop = pTmp - kiStrides;
- uint8_t* pBottom = pDstLastLine + kiStrides;
-
- // pad pTop and pBottom
- memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
- memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
-
- // pad corners
- memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
- memset (pTop + kiPicW, kuiTR, kiPaddingLen); //pTop right
- memset (pBottom - kiPaddingLen, kuiBL, kiPaddingLen); //pBottom left
- memset (pBottom + kiPicW, kuiBR, kiPaddingLen); //pBottom right
-
- ++ i;
- } while (i < kiPaddingLen);
-
- // pad left and right
- i = 0;
- do {
- memset (pTmp - kiPaddingLen, pTmp[0], kiPaddingLen);
- memset (pTmp + kiPicW, pTmp[kiPicW - 1], kiPaddingLen);
-
- pTmp += kiStride;
- ++ i;
- } while (i < kiPicH);
-}
-
-static inline void ExpandPictureChroma_c (uint8_t* pDst, const int32_t kiStride, const int32_t kiPicW,
- const int32_t kiPicH) {
- uint8_t* pTmp = pDst;
- uint8_t* pDstLastLine = pTmp + (kiPicH - 1) * kiStride;
- const int32_t kiPaddingLen = (PADDING_LENGTH >> 1);
- const uint8_t kuiTL = pTmp[0];
- const uint8_t kuiTR = pTmp[kiPicW - 1];
- const uint8_t kuiBL = pDstLastLine[0];
- const uint8_t kuiBR = pDstLastLine[kiPicW - 1];
- int32_t i = 0;
-
- do {
- const int32_t kiStrides = (1 + i) * kiStride;
- uint8_t* pTop = pTmp - kiStrides;
- uint8_t* pBottom = pDstLastLine + kiStrides;
-
- // pad pTop and pBottom
- memcpy (pTop, pTmp, kiPicW); // confirmed_safe_unsafe_usage
- memcpy (pBottom, pDstLastLine, kiPicW); // confirmed_safe_unsafe_usage
-
- // pad corners
- memset (pTop - kiPaddingLen, kuiTL, kiPaddingLen); //pTop left
- memset (pTop + kiPicW, kuiTR, kiPaddingLen); //pTop right
- memset (pBottom - kiPaddingLen, kuiBL, kiPaddingLen); //pBottom left
- memset (pBottom + kiPicW, kuiBR, kiPaddingLen); //pBottom right
-
- ++ i;
- } while (i < kiPaddingLen);
-
- // pad left and right
- i = 0;
- do {
- memset (pTmp - kiPaddingLen, pTmp[0], kiPaddingLen);
- memset (pTmp + kiPicW, pTmp[kiPicW - 1], kiPaddingLen);
-
- pTmp += kiStride;
- ++ i;
- } while (i < kiPicH);
-}
-
-void InitExpandPictureFunc (void* pL, const uint32_t kuiCPUFlag) {
- SWelsFuncPtrList* pFuncList = (SWelsFuncPtrList*)pL;
- pFuncList->pfExpandLumaPicture = ExpandPictureLuma_c;
- pFuncList->pfExpandChromaPicture[0] = ExpandPictureChroma_c;
- pFuncList->pfExpandChromaPicture[1] = ExpandPictureChroma_c;
-
-#if defined(X86_ASM)
- if ((kuiCPUFlag & WELS_CPU_SSE2) == WELS_CPU_SSE2) {
- pFuncList->pfExpandLumaPicture = ExpandPictureLuma_sse2;
- pFuncList->pfExpandChromaPicture[0] = ExpandPictureChromaUnalign_sse2;
- pFuncList->pfExpandChromaPicture[1] = ExpandPictureChromaAlign_sse2;
- }
-#endif//X86_ASM
-#if defined(HAVE_NEON)
- if (kuiCPUFlag & WELS_CPU_NEON) {
- pFuncList->pfExpandLumaPicture = ExpandPictureLuma_neon;
- pFuncList->pfExpandChromaPicture[0] = ExpandPictureChroma_neon;
- pFuncList->pfExpandChromaPicture[1] = ExpandPictureChroma_neon;
- }
-#endif//HAVE_NEON
-#if defined(HAVE_NEON_AARCH64)
- if (kuiCPUFlag & WELS_CPU_NEON) {
- pFuncList->pfExpandLumaPicture = ExpandPictureLuma_AArch64_neon;
- pFuncList->pfExpandChromaPicture[0] = ExpandPictureChroma_AArch64_neon;
- pFuncList->pfExpandChromaPicture[1] = ExpandPictureChroma_AArch64_neon;
- }
-#endif//HAVE_NEON_AARCH64
-}
-
-
-void ExpandReferencingPicture (SPicture* pPic, PExpandPictureFunc pExpLuma, PExpandPictureFunc pExpChrom[2]) {
- /*local variable*/
- uint8_t* pPicY = pPic->pData[0];
- uint8_t* pPicCb = pPic->pData[1];
- uint8_t* pPicCr = pPic->pData[2];
- const int32_t kiWidthY = pPic->iWidthInPixel;
- const int32_t kiHeightY = pPic->iHeightInPixel;
- const int32_t kiWidthUV = kiWidthY >> 1;
- const int32_t kiHeightUV = kiHeightY >> 1;
-
-
-
- pExpLuma (pPicY, pPic->iLineSize[0], kiWidthY, kiHeightY);
- if (kiWidthUV >= 16) {
- // fix coding picture size as 16x16
- const bool kbChrAligned = /*(iWidthUV >= 16) && */ ((kiWidthUV & 0x0F) == 0); // chroma planes: (16+iWidthUV) & 15
- pExpChrom[kbChrAligned] (pPicCb, pPic->iLineSize[1], kiWidthUV, kiHeightUV);
- pExpChrom[kbChrAligned] (pPicCr, pPic->iLineSize[2], kiWidthUV, kiHeightUV);
- } else {
- // fix coding picture size as 16x16
- ExpandPictureChroma_c (pPicCb, pPic->iLineSize[1], kiWidthUV, kiHeightUV);
- ExpandPictureChroma_c (pPicCr, pPic->iLineSize[2], kiWidthUV, kiHeightUV);
- }
-
-}
-
-}
--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -378,7 +378,9 @@
if ((pParamD->iHighestTemporalId == 0) || (kuiTid < pParamD->iHighestTemporalId))
#endif// !ENABLE_FRAME_DUMP
// Expanding picture for future reference
- ExpandReferencingPicture (pCtx->pDecPic, pCtx->pFuncList->pfExpandLumaPicture, pCtx->pFuncList->pfExpandChromaPicture);
+ ExpandReferencingPicture (pCtx->pDecPic->pData, pCtx->pDecPic->iWidthInPixel, pCtx->pDecPic->iHeightInPixel,
+ pCtx->pDecPic->iLineSize,
+ pCtx->pFuncList->sExpandPicFunc.pfExpandLumaPicture, pCtx->pFuncList->sExpandPicFunc.pfExpandChromaPicture);
// move picture in list
pCtx->pDecPic->uiTemporalId = kuiTid;
@@ -720,7 +722,9 @@
if ((pParamD->iHighestTemporalId == 0) || (kuiTid < pParamD->iHighestTemporalId))
#endif// !ENABLE_FRAME_DUMP
// Expanding picture for future reference
- ExpandReferencingPicture (pCtx->pDecPic, pCtx->pFuncList->pfExpandLumaPicture, pCtx->pFuncList->pfExpandChromaPicture);
+ ExpandReferencingPicture (pCtx->pDecPic->pData, pCtx->pDecPic->iWidthInPixel, pCtx->pDecPic->iHeightInPixel,
+ pCtx->pDecPic->iLineSize,
+ pCtx->pFuncList->sExpandPicFunc.pfExpandLumaPicture, pCtx->pFuncList->sExpandPicFunc.pfExpandChromaPicture);
// move picture in list
pCtx->pDecPic->uiTemporalId = pCtx->uiTemporalId;
--- a/codec/encoder/targets.mk
+++ b/codec/encoder/targets.mk
@@ -7,7 +7,6 @@
$(ENCODER_SRCDIR)/core/src/encoder.cpp\
$(ENCODER_SRCDIR)/core/src/encoder_data_tables.cpp\
$(ENCODER_SRCDIR)/core/src/encoder_ext.cpp\
- $(ENCODER_SRCDIR)/core/src/expand_pic.cpp\
$(ENCODER_SRCDIR)/core/src/get_intra_predictor.cpp\
$(ENCODER_SRCDIR)/core/src/mc.cpp\
$(ENCODER_SRCDIR)/core/src/md.cpp\
--- a/test/decoder/DecUT_ExpandPicture.cpp
+++ b/test/decoder/DecUT_ExpandPicture.cpp
@@ -2,6 +2,7 @@
#include "codec_def.h"
#include "expand_pic.h"
#include "mem_align.h"
+#include "decoder_context.h"
using namespace WelsDec;
#define EXPAND_PIC_TEST_NUM 10
namespace WelsDec {
@@ -120,7 +121,7 @@
}
}
H264ExpandPictureLumaAnchor_c (pAnchorDst, iStride, iPicWidth, iPicHeight);
- sExpandPicFunc.pExpandLumaPicture (pTestDst, iStride, iPicWidth, iPicHeight);
+ sExpandPicFunc.pfExpandLumaPicture (pTestDst, iStride, iPicWidth, iPicHeight);
EXPECT_EQ (CompareBuff (pAnchorDstBuff, pTestDstBuff, iStride, iPicWidth + H264_PADDING_LENGTH_LUMA * 2,
iPicHeight + H264_PADDING_LENGTH_LUMA * 2), true);
@@ -155,7 +156,7 @@
}
}
H264ExpandPictureChromaAnchor_c (pAnchorDst, iStride, iPicWidth, iPicHeight);
- sExpandPicFunc.pExpandChromaPicture[0] (pTestDst, iStride, iPicWidth, iPicHeight);
+ sExpandPicFunc.pfExpandChromaPicture[0] (pTestDst, iStride, iPicWidth, iPicHeight);
EXPECT_EQ (CompareBuff (pAnchorDstBuff, pTestDstBuff, iStride, iPicWidth + H264_PADDING_LENGTH_CHROMA * 2,
iPicHeight + H264_PADDING_LENGTH_CHROMA * 2), true);
@@ -199,7 +200,8 @@
H264ExpandPictureLumaAnchor_c (pPicAnchor->pData[0], iStride, iPicWidth, iPicHeight);
H264ExpandPictureChromaAnchor_c (pPicAnchor->pData[1], iStrideC, iPicWidth / 2, iPicHeight / 2);
H264ExpandPictureChromaAnchor_c (pPicAnchor->pData[2], iStrideC, iPicWidth / 2, iPicHeight / 2);
- ExpandReferencingPicture (sCtx.pDec, sExpandPicFunc.pExpandLumaPicture, sExpandPicFunc.pExpandChromaPicture);
+ ExpandReferencingPicture (sCtx.pDec->pData, sCtx.pDec->iWidthInPixel, sCtx.pDec->iHeightInPixel, sCtx.pDec->iLinesize,
+ sExpandPicFunc.pfExpandLumaPicture, sExpandPicFunc.pfExpandChromaPicture);
EXPECT_EQ (CompareBuff (pPicAnchor->pBuffer[0], pPicTest->pBuffer[0], iStride, iPicWidth + PADDING_LENGTH * 2,
iPicHeight + PADDING_LENGTH * 2), true);
--- a/test/encoder/EncUT_ExpandPic.cpp
+++ b/test/encoder/EncUT_ExpandPic.cpp
@@ -6,36 +6,36 @@
using namespace WelsSVCEnc;
-TEST(ExpandPicTest, TestExpandPictureLuma_c) {
+TEST (ExpandPicTest, TestExpandPictureLuma_c) {
SWelsFuncPtrList sFuncList;
- InitExpandPictureFunc( &sFuncList, 0 );
+ InitExpandPictureFunc (& (sFuncList.sExpandPicFunc), 0);
- int32_t iPicW = rand()%256 + 1;
- int32_t iPicH = rand()%256 + 1;
- int32_t iStride = iPicW + rand()%16 + 1 + PADDING_LENGTH * 2;
+ int32_t iPicW = rand() % 256 + 1;
+ int32_t iPicH = rand() % 256 + 1;
+ int32_t iStride = iPicW + rand() % 16 + 1 + PADDING_LENGTH * 2;
const int32_t kiPaddingLen = PADDING_LENGTH;
- const int32_t kiMemSize = (iStride+kiPaddingLen*2) * (iPicH+kiPaddingLen*2);
+ const int32_t kiMemSize = (iStride + kiPaddingLen * 2) * (iPicH + kiPaddingLen * 2);
- uint8_t *pRef = new uint8_t[kiMemSize];
+ uint8_t* pRef = new uint8_t[kiMemSize];
- for(int i=0; i<kiMemSize; i++)
- pRef[i] = rand()%256 + 1;
+ for (int i = 0; i < kiMemSize; i++)
+ pRef[i] = rand() % 256 + 1;
- uint8_t *pDst = pRef + kiPaddingLen * iStride + kiPaddingLen;
+ uint8_t* pDst = pRef + kiPaddingLen * iStride + kiPaddingLen;
- sFuncList.pfExpandLumaPicture(pDst, iStride, iPicW, iPicH);
+ sFuncList.sExpandPicFunc.pfExpandLumaPicture (pDst, iStride, iPicW, iPicH);
int k = 0;
//top and top corner
- for (int i=0; i<kiPaddingLen; i++) {
- for (int j=0; j<iPicW+2*kiPaddingLen; j++) {
+ for (int i = 0; i < kiPaddingLen; i++) {
+ for (int j = 0; j < iPicW + 2 * kiPaddingLen; j++) {
if (j < kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[0]);
- } else if (j >= iPicW+kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[iPicW-1]);
+ EXPECT_EQ (pRef[k + j], pDst[0]);
+ } else if (j >= iPicW + kiPaddingLen) {
+ EXPECT_EQ (pRef[k + j], pDst[iPicW - 1]);
} else
- EXPECT_EQ(pRef[k+j],pDst[j-kiPaddingLen]);
+ EXPECT_EQ (pRef[k + j], pDst[j - kiPaddingLen]);
}
k += iStride;
}
@@ -42,14 +42,14 @@
k = (iPicH + kiPaddingLen - 1) * iStride;
//bottom and bottom corner
- for (int i=iPicH+kiPaddingLen; i<iPicH+2*kiPaddingLen; i++) {
- for (int j=0; j<iPicW+2*kiPaddingLen; j++) {
+ for (int i = iPicH + kiPaddingLen; i < iPicH + 2 * kiPaddingLen; i++) {
+ for (int j = 0; j < iPicW + 2 * kiPaddingLen; j++) {
if (j < kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[(iPicH-1) * iStride]);
- } else if (j >= iPicW+kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[(iPicH-1) * iStride+iPicW-1]);
+ EXPECT_EQ (pRef[k + j], pDst[ (iPicH - 1) * iStride]);
+ } else if (j >= iPicW + kiPaddingLen) {
+ EXPECT_EQ (pRef[k + j], pDst[ (iPicH - 1) * iStride + iPicW - 1]);
} else
- EXPECT_EQ(pRef[k+j],pDst[(iPicH-1) * iStride+j-kiPaddingLen]);
+ EXPECT_EQ (pRef[k + j], pDst[ (iPicH - 1) * iStride + j - kiPaddingLen]);
}
k += iStride;
}
@@ -56,9 +56,9 @@
k = kiPaddingLen * iStride;
int l = 0;
- for (int i=0; i<iPicH-1; i++) { //left
- for (int j=0; j<kiPaddingLen; j++) {
- EXPECT_EQ(pRef[k+j],pDst[l]);
+ for (int i = 0; i < iPicH - 1; i++) { //left
+ for (int j = 0; j < kiPaddingLen; j++) {
+ EXPECT_EQ (pRef[k + j], pDst[l]);
}
k += iStride;
l += iStride;
@@ -66,9 +66,9 @@
k = kiPaddingLen * iStride;
l = 0;
- for (int i=0; i<iPicH-1; i++) { //right
- for (int j=iPicW+kiPaddingLen; j<iPicW+2*kiPaddingLen; j++) {
- EXPECT_EQ(pRef[k+j],pDst[l+iPicW-1]);
+ for (int i = 0; i < iPicH - 1; i++) { //right
+ for (int j = iPicW + kiPaddingLen; j < iPicW + 2 * kiPaddingLen; j++) {
+ EXPECT_EQ (pRef[k + j], pDst[l + iPicW - 1]);
}
k += iStride;
l += iStride;
@@ -77,37 +77,37 @@
delete []pRef;
}
-TEST(ExpandPicTest, TestExpandPictureChroma_c) {
+TEST (ExpandPicTest, TestExpandPictureChroma_c) {
SWelsFuncPtrList sFuncList;
- InitExpandPictureFunc( &sFuncList, 0 );
+ InitExpandPictureFunc (& (sFuncList.sExpandPicFunc), 0);
- int32_t iPicW = rand()%256 + 1;
- int32_t iPicH = rand()%256 + 1;
+ int32_t iPicW = rand() % 256 + 1;
+ int32_t iPicH = rand() % 256 + 1;
- const int32_t kiPaddingLen = (PADDING_LENGTH>>1);
- int32_t iStride = iPicW + rand()%16 + 1 + kiPaddingLen*2;
+ const int32_t kiPaddingLen = (PADDING_LENGTH >> 1);
+ int32_t iStride = iPicW + rand() % 16 + 1 + kiPaddingLen * 2;
- const int32_t kiMemSize = (iStride+kiPaddingLen*2) * (iPicH+kiPaddingLen*2);
+ const int32_t kiMemSize = (iStride + kiPaddingLen * 2) * (iPicH + kiPaddingLen * 2);
- uint8_t *pRef = new uint8_t[kiMemSize];
+ uint8_t* pRef = new uint8_t[kiMemSize];
- for (int i=0; i<kiMemSize; i++)
- pRef[i] = rand()%256 + 1;
+ for (int i = 0; i < kiMemSize; i++)
+ pRef[i] = rand() % 256 + 1;
- uint8_t *pDst = pRef + kiPaddingLen * iStride + kiPaddingLen;
+ uint8_t* pDst = pRef + kiPaddingLen * iStride + kiPaddingLen;
- sFuncList.pfExpandChromaPicture[0](pDst,iStride, iPicW, iPicH);
+ sFuncList.sExpandPicFunc.pfExpandChromaPicture[0] (pDst, iStride, iPicW, iPicH);
int k = 0;
//top and top corner
- for (int i=0; i<kiPaddingLen; i++) {
- for (int j=0; j<iPicW+2*kiPaddingLen; j++) {
+ for (int i = 0; i < kiPaddingLen; i++) {
+ for (int j = 0; j < iPicW + 2 * kiPaddingLen; j++) {
if (j < kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[0]);
- } else if (j >= iPicW+kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[iPicW-1]);
+ EXPECT_EQ (pRef[k + j], pDst[0]);
+ } else if (j >= iPicW + kiPaddingLen) {
+ EXPECT_EQ (pRef[k + j], pDst[iPicW - 1]);
} else
- EXPECT_EQ(pRef[k+j],pDst[j-kiPaddingLen]);
+ EXPECT_EQ (pRef[k + j], pDst[j - kiPaddingLen]);
}
k += iStride;
}
@@ -114,23 +114,23 @@
k = (iPicH + kiPaddingLen - 1) * iStride;
//bottom and bottom corner
- for (int i=iPicH+kiPaddingLen; i<iPicH+2*kiPaddingLen; i++) {
- for (int j=0; j<iPicW+2*kiPaddingLen; j++) {
+ for (int i = iPicH + kiPaddingLen; i < iPicH + 2 * kiPaddingLen; i++) {
+ for (int j = 0; j < iPicW + 2 * kiPaddingLen; j++) {
if (j < kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[(iPicH-1) * iStride]);
- } else if (j >= iPicW+kiPaddingLen) {
- EXPECT_EQ(pRef[k+j],pDst[(iPicH-1) * iStride + iPicW - 1]);
+ EXPECT_EQ (pRef[k + j], pDst[ (iPicH - 1) * iStride]);
+ } else if (j >= iPicW + kiPaddingLen) {
+ EXPECT_EQ (pRef[k + j], pDst[ (iPicH - 1) * iStride + iPicW - 1]);
} else
- EXPECT_EQ(pRef[k+j],pDst[(iPicH-1) * iStride + j - kiPaddingLen]);
+ EXPECT_EQ (pRef[k + j], pDst[ (iPicH - 1) * iStride + j - kiPaddingLen]);
}
k += iStride;
}
k = kiPaddingLen * iStride;
- int l=0;
- for (int i=0; i<iPicH-1; i++) { //left
- for (int j=0; j<kiPaddingLen; j++) {
- EXPECT_EQ(pRef[k+j],pDst[l]);
+ int l = 0;
+ for (int i = 0; i < iPicH - 1; i++) { //left
+ for (int j = 0; j < kiPaddingLen; j++) {
+ EXPECT_EQ (pRef[k + j], pDst[l]);
}
k += iStride;
l += iStride;
@@ -138,9 +138,9 @@
k = kiPaddingLen * iStride;
l = 0;
- for (int i=0; i<iPicH-1; i++) { //right
- for (int j=iPicW+kiPaddingLen; j<iPicW+2*kiPaddingLen; j++) {
- EXPECT_EQ(pRef[k+j],pDst[l+iPicW-1]);
+ for (int i = 0; i < iPicH - 1; i++) { //right
+ for (int j = iPicW + kiPaddingLen; j < iPicW + 2 * kiPaddingLen; j++) {
+ EXPECT_EQ (pRef[k + j], pDst[l + iPicW - 1]);
}
k += iStride;
l += iStride;