• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    copy_mb.cpp
33  *
34  * \brief   copy MB YUV data
35  *
36  * \date    2014.04.14 Created
37  *
38  *************************************************************************************
39  */
40 
41 #include "copy_mb.h"
42 #include "macros.h"
43 #include "ls_defines.h"
44 
45 /****************************************************************************
46  * Copy functions
47  ****************************************************************************/
WelsCopy4x4_c(uint8_t * pDst,int32_t iStrideD,uint8_t * pSrc,int32_t iStrideS)48 void WelsCopy4x4_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) {
49   const int32_t kiSrcStride2 = iStrideS << 1;
50   const int32_t kiSrcStride3 = iStrideS + kiSrcStride2;
51   const int32_t kiDstStride2 = iStrideD << 1;
52   const int32_t kiDstStride3 = iStrideD + kiDstStride2;
53 
54   ST32 (pDst,                LD32 (pSrc));
55   ST32 (pDst + iStrideD,     LD32 (pSrc + iStrideS));
56   ST32 (pDst + kiDstStride2, LD32 (pSrc + kiSrcStride2));
57   ST32 (pDst + kiDstStride3, LD32 (pSrc + kiSrcStride3));
58 }
WelsCopy8x4_c(uint8_t * pDst,int32_t iStrideD,uint8_t * pSrc,int32_t iStrideS)59 void WelsCopy8x4_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) {
60   WelsCopy4x4_c (pDst, iStrideD, pSrc, iStrideS);
61   WelsCopy4x4_c (pDst + 4, iStrideD, pSrc + 4, iStrideS);
62 }
WelsCopy4x8_c(uint8_t * pDst,int32_t iStrideD,uint8_t * pSrc,int32_t iStrideS)63 void WelsCopy4x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) {
64   WelsCopy4x4_c (pDst, iStrideD, pSrc, iStrideS);
65   WelsCopy4x4_c (pDst + (iStrideD << 2), iStrideD, pSrc + (iStrideS << 2), iStrideS);
66 }
WelsCopy8x8_c(uint8_t * pDst,int32_t iStrideD,uint8_t * pSrc,int32_t iStrideS)67 void WelsCopy8x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) {
68   int32_t i;
69   for (i = 0; i < 4; i++) {
70     ST32 (pDst,                 LD32 (pSrc));
71     ST32 (pDst + 4 ,            LD32 (pSrc + 4));
72     ST32 (pDst + iStrideD,      LD32 (pSrc + iStrideS));
73     ST32 (pDst + iStrideD + 4 , LD32 (pSrc + iStrideS + 4));
74     pDst += iStrideD << 1;
75     pSrc += iStrideS << 1;
76   }
77 }
WelsCopy8x16_c(uint8_t * pDst,int32_t iStrideD,uint8_t * pSrc,int32_t iStrideS)78 void WelsCopy8x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) {
79   int32_t i;
80   for (i = 0; i < 8; ++i) {
81     ST32 (pDst,                 LD32 (pSrc));
82     ST32 (pDst + 4 ,            LD32 (pSrc + 4));
83     ST32 (pDst + iStrideD,      LD32 (pSrc + iStrideS));
84     ST32 (pDst + iStrideD + 4 , LD32 (pSrc + iStrideS + 4));
85     pDst += iStrideD << 1;
86     pSrc += iStrideS << 1;
87   }
88 }
WelsCopy16x8_c(uint8_t * pDst,int32_t iStrideD,uint8_t * pSrc,int32_t iStrideS)89 void WelsCopy16x8_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) {
90   int32_t i;
91   for (i = 0; i < 8; i++) {
92     ST32 (pDst,         LD32 (pSrc));
93     ST32 (pDst + 4 ,    LD32 (pSrc + 4));
94     ST32 (pDst + 8 ,    LD32 (pSrc + 8));
95     ST32 (pDst + 12 ,   LD32 (pSrc + 12));
96     pDst += iStrideD ;
97     pSrc += iStrideS;
98   }
99 }
WelsCopy16x16_c(uint8_t * pDst,int32_t iStrideD,uint8_t * pSrc,int32_t iStrideS)100 void WelsCopy16x16_c (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS) {
101   int32_t i;
102   for (i = 0; i < 16; i++) {
103     ST32 (pDst,         LD32 (pSrc));
104     ST32 (pDst + 4 ,    LD32 (pSrc + 4));
105     ST32 (pDst + 8 ,    LD32 (pSrc + 8));
106     ST32 (pDst + 12 ,   LD32 (pSrc + 12));
107     pDst += iStrideD ;
108     pSrc += iStrideS;
109   }
110 }
111 
112