| 1 | /* The copyright in this software is being made available under the BSD |
|---|
| 2 | * License, included below. This software may be subject to other third party |
|---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
|---|
| 4 | * granted under this license. |
|---|
| 5 | * |
|---|
| 6 | * Copyright (c) 2010-2011, ISO/IEC |
|---|
| 7 | * All rights reserved. |
|---|
| 8 | * |
|---|
| 9 | * Redistribution and use in source and binary forms, with or without |
|---|
| 10 | * modification, are permitted provided that the following conditions are met: |
|---|
| 11 | * |
|---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
|---|
| 13 | * this list of conditions and the following disclaimer. |
|---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
|---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
|---|
| 16 | * and/or other materials provided with the distribution. |
|---|
| 17 | * * Neither the name of the ISO/IEC nor the names of its contributors may |
|---|
| 18 | * be used to endorse or promote products derived from this software without |
|---|
| 19 | * specific prior written permission. |
|---|
| 20 | * |
|---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
|---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
|---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 32 | */ |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | /** \file TRenInterpFilter.h |
|---|
| 37 | \brief interpolation filter class (header), (From HM 3.0 TComPredFilter)) |
|---|
| 38 | */ |
|---|
| 39 | |
|---|
| 40 | #ifndef __TRENINTERPFILTER__ |
|---|
| 41 | #define __TRENINTERPFILTER__ |
|---|
| 42 | |
|---|
| 43 | // Include files |
|---|
| 44 | #include "TLibCommon/CommonDef.h" |
|---|
| 45 | #include "assert.h" |
|---|
| 46 | #if H_3D |
|---|
| 47 | |
|---|
| 48 | // ==================================================================================================================== |
|---|
| 49 | // Constants |
|---|
| 50 | // ==================================================================================================================== |
|---|
| 51 | |
|---|
| 52 | // Local type definitions |
|---|
| 53 | #define HAL_IDX 1 |
|---|
| 54 | #define QU0_IDX 0 |
|---|
| 55 | #define QU1_IDX 2 |
|---|
| 56 | |
|---|
| 57 | // ==================================================================================================================== |
|---|
| 58 | // Class definition |
|---|
| 59 | // ==================================================================================================================== |
|---|
| 60 | |
|---|
| 61 | /// interpolation filter class |
|---|
| 62 | class TRenInterpFilter |
|---|
| 63 | { |
|---|
| 64 | public: |
|---|
| 65 | TRenInterpFilter(); |
|---|
| 66 | |
|---|
| 67 | // DIF filter interface (for half & quarter) |
|---|
| 68 | __inline Void xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
|---|
| 69 | __inline Void xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
|---|
| 70 | |
|---|
| 71 | __inline Void xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
|---|
| 72 | __inline Void xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
|---|
| 73 | |
|---|
| 74 | __inline Void xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
|---|
| 75 | __inline Void xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); |
|---|
| 76 | |
|---|
| 77 | __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel ); |
|---|
| 78 | __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst ); |
|---|
| 79 | __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
|---|
| 80 | |
|---|
| 81 | __inline Void xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst ); |
|---|
| 82 | __inline Void xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
|---|
| 83 | |
|---|
| 84 | __inline Void xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst ); |
|---|
| 85 | __inline Void xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); |
|---|
| 86 | |
|---|
| 87 | __inline Void xCTI_Filter2DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Int*& rpiDst, Int iMv); |
|---|
| 88 | __inline Void xCTI_Filter2DHorC (Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
|---|
| 89 | __inline Void xCTI_Filter1DHorC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
|---|
| 90 | __inline Void xCTI_Filter1DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV); |
|---|
| 91 | |
|---|
| 92 | __inline Int xCTI_Filter_VPS04_C_HAL( Pel* pSrc, Int iStride ); |
|---|
| 93 | __inline Int xCTI_Filter_VIS04_C_HAL( Int* pSrc, Int iStride ); |
|---|
| 94 | __inline Int xCTI_Filter_VP04_C_OCT0( Pel* pSrc, Int iStride ); |
|---|
| 95 | __inline Int xCTI_Filter_VI04_C_OCT0( Int* pSrc, Int iStride ); |
|---|
| 96 | __inline Int xCTI_Filter_VP04_C_QUA0( Pel* pSrc, Int iStride ); |
|---|
| 97 | __inline Int xCTI_Filter_VI04_C_QUA0( Int* pSrc, Int iStride ); |
|---|
| 98 | __inline Int xCTI_Filter_VP04_C_OCT1( Pel* pSrc, Int iStride ); |
|---|
| 99 | __inline Int xCTI_Filter_VI04_C_OCT1( Int* pSrc, Int iStride ); |
|---|
| 100 | __inline Int xCTI_Filter_VP04_C_OCT2( Pel* pSrc, Int iStride ); |
|---|
| 101 | __inline Int xCTI_Filter_VI04_C_OCT2( Int* pSrc, Int iStride ); |
|---|
| 102 | __inline Int xCTI_Filter_VP04_C_QUA1( Pel* pSrc, Int iStride ); |
|---|
| 103 | __inline Int xCTI_Filter_VI04_C_QUA1( Int* pSrc, Int iStride ); |
|---|
| 104 | __inline Int xCTI_Filter_VP04_C_OCT3( Pel* pSrc, Int iStride ); |
|---|
| 105 | __inline Int xCTI_Filter_VI04_C_OCT3( Int* pSrc, Int iStride ); |
|---|
| 106 | |
|---|
| 107 | }; |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | // ------------------------------------------------------------------------------------------------ |
|---|
| 111 | // DCTIF filters |
|---|
| 112 | // ------------------------------------------------------------------------------------------------ |
|---|
| 113 | |
|---|
| 114 | __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 115 | { |
|---|
| 116 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 117 | |
|---|
| 118 | Pel* piDst = rpiDst; |
|---|
| 119 | Int iSum; |
|---|
| 120 | Pel* piSrcTmp; |
|---|
| 121 | Int iSrcStep2 = iSrcStep*2; |
|---|
| 122 | Int iSrcStep3 = iSrcStep*3; |
|---|
| 123 | Int iSrcStep4 = iSrcStep*4; |
|---|
| 124 | Int iSrcStep5 = iSrcStep*5; |
|---|
| 125 | Int iSrcStep6 = iSrcStep*6; |
|---|
| 126 | Int iSrcStep7 = iSrcStep*7; |
|---|
| 127 | |
|---|
| 128 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
|---|
| 129 | |
|---|
| 130 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 131 | { |
|---|
| 132 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
|---|
| 133 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 134 | { |
|---|
| 135 | // { -1,4,-11,40,40,-11,4,-1 } |
|---|
| 136 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7]; |
|---|
| 137 | iTmp1 = piSrcTmp[iSrcStep]+piSrcTmp[iSrcStep6]; |
|---|
| 138 | iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5]; |
|---|
| 139 | iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4]; |
|---|
| 140 | |
|---|
| 141 | iTmpA = (iTmp3 << 2) - iTmp2; |
|---|
| 142 | |
|---|
| 143 | iSum = ( iTmp1 << 2 ) |
|---|
| 144 | + ( iTmpA << 3 ) |
|---|
| 145 | + ( iTmpA << 1 ) |
|---|
| 146 | - iTmp0 - iTmp2; |
|---|
| 147 | |
|---|
| 148 | piDst [x * iDstStep] = ClipY( (iSum + 32) >> 6 ); |
|---|
| 149 | piSrcTmp += iSrcStep; |
|---|
| 150 | } |
|---|
| 151 | piSrc += iSrcStride; |
|---|
| 152 | piDst += iDstStride; |
|---|
| 153 | } |
|---|
| 154 | return; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 158 | { |
|---|
| 159 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 160 | |
|---|
| 161 | Pel* piDst = rpiDst; |
|---|
| 162 | Int iSum; |
|---|
| 163 | Int* piSrcTmp; |
|---|
| 164 | Int iSrcStep2 = iSrcStep*2; |
|---|
| 165 | Int iSrcStep3 = iSrcStep*3; |
|---|
| 166 | Int iSrcStep4 = iSrcStep*4; |
|---|
| 167 | Int iSrcStep5 = iSrcStep*5; |
|---|
| 168 | Int iSrcStep6 = iSrcStep*6; |
|---|
| 169 | Int iSrcStep7 = iSrcStep*7; |
|---|
| 170 | |
|---|
| 171 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
|---|
| 172 | |
|---|
| 173 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 174 | { |
|---|
| 175 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
|---|
| 176 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 177 | { |
|---|
| 178 | // { -1,4,-11,40,40,-11,4,-1 } |
|---|
| 179 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStep7]; |
|---|
| 180 | iTmp1 = piSrcTmp[iSrcStep ]+piSrcTmp[iSrcStep6]; |
|---|
| 181 | iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5]; |
|---|
| 182 | iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4]; |
|---|
| 183 | |
|---|
| 184 | iTmpA = (iTmp3 << 2) - iTmp2; |
|---|
| 185 | |
|---|
| 186 | iSum = ( iTmp1 << 2 ) |
|---|
| 187 | + ( iTmpA << 3 ) |
|---|
| 188 | + ( iTmpA << 1 ) |
|---|
| 189 | - iTmp0 - iTmp2; |
|---|
| 190 | |
|---|
| 191 | piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 ); |
|---|
| 192 | piSrcTmp += iSrcStep; |
|---|
| 193 | } |
|---|
| 194 | piSrc += iSrcStride; |
|---|
| 195 | piDst += iDstStride; |
|---|
| 196 | } |
|---|
| 197 | return; |
|---|
| 198 | } |
|---|
| 199 | |
|---|
| 200 | __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 201 | { |
|---|
| 202 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 203 | Pel* piDst = rpiDst; |
|---|
| 204 | Int iSum; |
|---|
| 205 | Pel* piSrcTmp; |
|---|
| 206 | Int iSrcStep2 = iSrcStep*2; |
|---|
| 207 | Int iSrcStep3 = iSrcStep*3; |
|---|
| 208 | Int iSrcStep4 = iSrcStep*4; |
|---|
| 209 | Int iSrcStep5 = iSrcStep*5; |
|---|
| 210 | Int iSrcStep6 = iSrcStep*6; |
|---|
| 211 | Int iSrcStep7 = iSrcStep*7; |
|---|
| 212 | |
|---|
| 213 | Int iTmp1, iTmp2; |
|---|
| 214 | |
|---|
| 215 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 216 | { |
|---|
| 217 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
|---|
| 218 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 219 | { |
|---|
| 220 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
|---|
| 221 | |
|---|
| 222 | iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5]; |
|---|
| 223 | iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4]; |
|---|
| 224 | |
|---|
| 225 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
|---|
| 226 | - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) |
|---|
| 227 | + ( piSrcTmp[iSrcStep] << 2 ) |
|---|
| 228 | - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) |
|---|
| 229 | + ( piSrcTmp[iSrcStep4] << 4 ); |
|---|
| 230 | |
|---|
| 231 | piDst [x * iDstStep] = ClipY(( (iSum + 32) >> 6 )+ piSrcTmp[iSrcStep3]); |
|---|
| 232 | piSrcTmp += iSrcStep; |
|---|
| 233 | } |
|---|
| 234 | piSrc += iSrcStride; |
|---|
| 235 | piDst += iDstStride; |
|---|
| 236 | } |
|---|
| 237 | return; |
|---|
| 238 | } |
|---|
| 239 | |
|---|
| 240 | __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 241 | { |
|---|
| 242 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 243 | |
|---|
| 244 | Pel* piDst = rpiDst; |
|---|
| 245 | Int iSum; |
|---|
| 246 | Int* piSrcTmp; |
|---|
| 247 | Int iSrcStep2 = iSrcStep*2; |
|---|
| 248 | Int iSrcStep3 = iSrcStep*3; |
|---|
| 249 | Int iSrcStep4 = iSrcStep*4; |
|---|
| 250 | Int iSrcStep5 = iSrcStep*5; |
|---|
| 251 | Int iSrcStep6 = iSrcStep*6; |
|---|
| 252 | Int iSrcStep7 = iSrcStep*7; |
|---|
| 253 | |
|---|
| 254 | Int iTmp1, iTmp2; |
|---|
| 255 | |
|---|
| 256 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 257 | { |
|---|
| 258 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
|---|
| 259 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 260 | { |
|---|
| 261 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
|---|
| 262 | |
|---|
| 263 | iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5]; |
|---|
| 264 | iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4]; |
|---|
| 265 | |
|---|
| 266 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
|---|
| 267 | - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 ) |
|---|
| 268 | + ( piSrcTmp[iSrcStep] << 2 ) |
|---|
| 269 | - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 ) |
|---|
| 270 | + ( piSrcTmp[iSrcStep4] << 4 ) |
|---|
| 271 | + ( piSrcTmp[iSrcStep3] << 6 ); |
|---|
| 272 | |
|---|
| 273 | piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 ); |
|---|
| 274 | piSrcTmp += iSrcStep; |
|---|
| 275 | } |
|---|
| 276 | piSrc += iSrcStride; |
|---|
| 277 | piDst += iDstStride; |
|---|
| 278 | } |
|---|
| 279 | return; |
|---|
| 280 | } |
|---|
| 281 | |
|---|
| 282 | __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 283 | { |
|---|
| 284 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 285 | Pel* piDst = rpiDst; |
|---|
| 286 | Int iSum; |
|---|
| 287 | Pel* piSrcTmp; |
|---|
| 288 | Int iSrcStep2 = iSrcStep*2; |
|---|
| 289 | Int iSrcStep3 = iSrcStep*3; |
|---|
| 290 | Int iSrcStep4 = iSrcStep*4; |
|---|
| 291 | Int iSrcStep5 = iSrcStep*5; |
|---|
| 292 | Int iSrcStep6 = iSrcStep*6; |
|---|
| 293 | Int iSrcStep7 = iSrcStep*7; |
|---|
| 294 | |
|---|
| 295 | Int iTmp1, iTmp2; |
|---|
| 296 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 297 | { |
|---|
| 298 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
|---|
| 299 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 300 | { |
|---|
| 301 | // {-1, 3, -7, 19, 57, -10, 4, -1 }, |
|---|
| 302 | |
|---|
| 303 | iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; |
|---|
| 304 | iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; |
|---|
| 305 | |
|---|
| 306 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
|---|
| 307 | - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) |
|---|
| 308 | + ( piSrcTmp[iSrcStep6] << 2 ) |
|---|
| 309 | - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) |
|---|
| 310 | + ( piSrcTmp[iSrcStep3] << 4 ); |
|---|
| 311 | |
|---|
| 312 | piDst [x * iDstStep] = ClipY( ((iSum + 32) >> 6) + piSrcTmp[iSrcStep4] ); |
|---|
| 313 | piSrcTmp += iSrcStep; |
|---|
| 314 | } |
|---|
| 315 | piSrc += iSrcStride; |
|---|
| 316 | piDst += iDstStride; |
|---|
| 317 | } |
|---|
| 318 | return; |
|---|
| 319 | } |
|---|
| 320 | |
|---|
| 321 | __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 322 | { |
|---|
| 323 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 324 | |
|---|
| 325 | Pel* piDst = rpiDst; |
|---|
| 326 | Int iSum; |
|---|
| 327 | Int* piSrcTmp; |
|---|
| 328 | Int iSrcStep2 = iSrcStep*2; |
|---|
| 329 | Int iSrcStep3 = iSrcStep*3; |
|---|
| 330 | Int iSrcStep4 = iSrcStep*4; |
|---|
| 331 | Int iSrcStep5 = iSrcStep*5; |
|---|
| 332 | Int iSrcStep6 = iSrcStep*6; |
|---|
| 333 | Int iSrcStep7 = iSrcStep*7; |
|---|
| 334 | |
|---|
| 335 | Int iTmp1, iTmp2; |
|---|
| 336 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 337 | { |
|---|
| 338 | piSrcTmp = &piSrc[ -3*iSrcStep ]; |
|---|
| 339 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 340 | { |
|---|
| 341 | // {-1, 3, -7, 19, 57, -10, 4, -1 }, |
|---|
| 342 | |
|---|
| 343 | iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2]; |
|---|
| 344 | iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3]; |
|---|
| 345 | |
|---|
| 346 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7] |
|---|
| 347 | - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 ) |
|---|
| 348 | + ( piSrcTmp[iSrcStep6] << 2 ) |
|---|
| 349 | - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 ) |
|---|
| 350 | + ( piSrcTmp[iSrcStep3] << 4 ) |
|---|
| 351 | + ( piSrcTmp[iSrcStep4] << 6 ); |
|---|
| 352 | |
|---|
| 353 | piDst [x * iDstStep] = ClipY( (iSum + 2048) >> 12 ); |
|---|
| 354 | piSrcTmp += iSrcStep; |
|---|
| 355 | } |
|---|
| 356 | piSrc += iSrcStride; |
|---|
| 357 | piDst += iDstStride; |
|---|
| 358 | } |
|---|
| 359 | return; |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel ) |
|---|
| 363 | { |
|---|
| 364 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 365 | Int* piDst = rpiDst; |
|---|
| 366 | Pel* piDstPel = rpiDstPel; |
|---|
| 367 | Int iSum; |
|---|
| 368 | Pel* piSrcTmp; |
|---|
| 369 | Int iSrcStride2 = iSrcStride*2; |
|---|
| 370 | Int iSrcStride3 = iSrcStride*3; |
|---|
| 371 | Int iSrcStride4 = iSrcStride*4; |
|---|
| 372 | Int iSrcStride5 = iSrcStride*5; |
|---|
| 373 | Int iSrcStride6 = iSrcStride*6; |
|---|
| 374 | Int iSrcStride7 = iSrcStride*7; |
|---|
| 375 | |
|---|
| 376 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
|---|
| 377 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 378 | { |
|---|
| 379 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
|---|
| 380 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 381 | { |
|---|
| 382 | // { -1,4,-11,40,40,-11,4,-1 } |
|---|
| 383 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; |
|---|
| 384 | iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; |
|---|
| 385 | iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; |
|---|
| 386 | iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; |
|---|
| 387 | |
|---|
| 388 | iTmpA = (iTmp3 << 2) - iTmp2; |
|---|
| 389 | |
|---|
| 390 | iSum = ( iTmp1 << 2 ) |
|---|
| 391 | + ( iTmpA << 3 ) |
|---|
| 392 | + ( iTmpA << 1 ) |
|---|
| 393 | - iTmp0 - iTmp2; |
|---|
| 394 | |
|---|
| 395 | piDst[x * iDstStep] = iSum; |
|---|
| 396 | piDstPel[x * iDstStep] = ClipY( (iSum + 32) >> 6 ); |
|---|
| 397 | piSrcTmp += iSrcStep; |
|---|
| 398 | } |
|---|
| 399 | piSrc += iSrcStride; |
|---|
| 400 | piDst += iDstStride; |
|---|
| 401 | piDstPel += iDstStridePel; |
|---|
| 402 | } |
|---|
| 403 | return; |
|---|
| 404 | } |
|---|
| 405 | |
|---|
| 406 | __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) |
|---|
| 407 | { |
|---|
| 408 | Int* piDst = rpiDst; |
|---|
| 409 | Int iSum; |
|---|
| 410 | Pel* piSrcTmp; |
|---|
| 411 | Int iSrcStride2 = iSrcStride*2; |
|---|
| 412 | Int iSrcStride3 = iSrcStride*3; |
|---|
| 413 | Int iSrcStride4 = iSrcStride*4; |
|---|
| 414 | Int iSrcStride5 = iSrcStride*5; |
|---|
| 415 | Int iSrcStride6 = iSrcStride*6; |
|---|
| 416 | Int iSrcStride7 = iSrcStride*7; |
|---|
| 417 | |
|---|
| 418 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
|---|
| 419 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 420 | { |
|---|
| 421 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
|---|
| 422 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 423 | { |
|---|
| 424 | // { -1,4,-11,40,40,-11,4,-1 } |
|---|
| 425 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; |
|---|
| 426 | iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; |
|---|
| 427 | iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; |
|---|
| 428 | iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; |
|---|
| 429 | |
|---|
| 430 | iTmpA = (iTmp3 << 2) - iTmp2; |
|---|
| 431 | |
|---|
| 432 | iSum = ( iTmp1 << 2 ) |
|---|
| 433 | + ( iTmpA << 3 ) |
|---|
| 434 | + ( iTmpA << 1 ) |
|---|
| 435 | - iTmp0 - iTmp2; |
|---|
| 436 | |
|---|
| 437 | piDst[x * iDstStep] = iSum; |
|---|
| 438 | piSrcTmp += iSrcStep; |
|---|
| 439 | } |
|---|
| 440 | piSrc += iSrcStride; |
|---|
| 441 | piDst += iDstStride; |
|---|
| 442 | } |
|---|
| 443 | return; |
|---|
| 444 | } |
|---|
| 445 | |
|---|
| 446 | __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 447 | { |
|---|
| 448 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 449 | Pel* piDst = rpiDst; |
|---|
| 450 | Int iSum; |
|---|
| 451 | Pel* piSrcTmp; |
|---|
| 452 | |
|---|
| 453 | Int iSrcStride2 = iSrcStride*2; |
|---|
| 454 | Int iSrcStride3 = iSrcStride*3; |
|---|
| 455 | Int iSrcStride4 = iSrcStride*4; |
|---|
| 456 | Int iSrcStride5 = iSrcStride*5; |
|---|
| 457 | Int iSrcStride6 = iSrcStride*6; |
|---|
| 458 | Int iSrcStride7 = iSrcStride*7; |
|---|
| 459 | |
|---|
| 460 | Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA; |
|---|
| 461 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 462 | { |
|---|
| 463 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
|---|
| 464 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 465 | { |
|---|
| 466 | // { -1,4,-11,40,40,-11,4,-1 } |
|---|
| 467 | iTmp0 = piSrcTmp[ 0]+piSrcTmp[iSrcStride7]; |
|---|
| 468 | iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6]; |
|---|
| 469 | iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5]; |
|---|
| 470 | iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4]; |
|---|
| 471 | |
|---|
| 472 | iTmpA = (iTmp3 << 2) - iTmp2; |
|---|
| 473 | |
|---|
| 474 | iSum = ( iTmp1 << 2 ) |
|---|
| 475 | + ( iTmpA << 3 ) |
|---|
| 476 | + ( iTmpA << 1 ) |
|---|
| 477 | - iTmp0 - iTmp2; |
|---|
| 478 | |
|---|
| 479 | piDst[x * iDstStep] = ClipY( (iSum + 32) >> 6 ); |
|---|
| 480 | piSrcTmp += iSrcStep; |
|---|
| 481 | } |
|---|
| 482 | piSrc += iSrcStride; |
|---|
| 483 | piDst += iDstStride; |
|---|
| 484 | } |
|---|
| 485 | return; |
|---|
| 486 | } |
|---|
| 487 | |
|---|
| 488 | __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) |
|---|
| 489 | { |
|---|
| 490 | Int* piDst = rpiDst; |
|---|
| 491 | Int iSum; |
|---|
| 492 | Pel* piSrcTmp; |
|---|
| 493 | Int iSrcStride2 = iSrcStride*2; |
|---|
| 494 | Int iSrcStride3 = iSrcStride*3; |
|---|
| 495 | Int iSrcStride4 = iSrcStride*4; |
|---|
| 496 | Int iSrcStride5 = iSrcStride*5; |
|---|
| 497 | Int iSrcStride6 = iSrcStride*6; |
|---|
| 498 | Int iSrcStride7 = iSrcStride*7; |
|---|
| 499 | |
|---|
| 500 | Int iTmp1, iTmp2; |
|---|
| 501 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 502 | { |
|---|
| 503 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
|---|
| 504 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 505 | { |
|---|
| 506 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
|---|
| 507 | |
|---|
| 508 | iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5]; |
|---|
| 509 | iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4]; |
|---|
| 510 | |
|---|
| 511 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
|---|
| 512 | - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 ) |
|---|
| 513 | + ( piSrcTmp[iSrcStride] << 2 ) |
|---|
| 514 | - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 ) |
|---|
| 515 | + ( piSrcTmp[iSrcStride4] << 4 ) |
|---|
| 516 | + ( piSrcTmp[iSrcStride3] << 6 ); |
|---|
| 517 | |
|---|
| 518 | piDst[x * iDstStep] = iSum; |
|---|
| 519 | piSrcTmp += iSrcStep; |
|---|
| 520 | } |
|---|
| 521 | piSrc += iSrcStride; |
|---|
| 522 | piDst += iDstStride; |
|---|
| 523 | } |
|---|
| 524 | return; |
|---|
| 525 | } |
|---|
| 526 | |
|---|
| 527 | __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 528 | { |
|---|
| 529 | assert( g_bitDepthC == g_bitDepthY ); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 530 | Pel* piDst = rpiDst; |
|---|
| 531 | Int iSum; |
|---|
| 532 | Pel* piSrcTmp; |
|---|
| 533 | |
|---|
| 534 | Int iSrcStride2 = iSrcStride*2; |
|---|
| 535 | Int iSrcStride3 = iSrcStride*3; |
|---|
| 536 | Int iSrcStride4 = iSrcStride*4; |
|---|
| 537 | Int iSrcStride5 = iSrcStride*5; |
|---|
| 538 | Int iSrcStride6 = iSrcStride*6; |
|---|
| 539 | Int iSrcStride7 = iSrcStride*7; |
|---|
| 540 | |
|---|
| 541 | Int iTmp1, iTmp2; |
|---|
| 542 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 543 | { |
|---|
| 544 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
|---|
| 545 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 546 | { |
|---|
| 547 | // {-1, 4, -10, 57, 19, -7, 3, -1 }, |
|---|
| 548 | |
|---|
| 549 | iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5]; |
|---|
| 550 | iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4]; |
|---|
| 551 | |
|---|
| 552 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
|---|
| 553 | - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 ) |
|---|
| 554 | + ( piSrcTmp[iSrcStride] << 2 ) |
|---|
| 555 | - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 ) |
|---|
| 556 | + ( piSrcTmp[iSrcStride4] << 4 ); |
|---|
| 557 | |
|---|
| 558 | piDst[x * iDstStep] = ClipY( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride3] ); |
|---|
| 559 | piSrcTmp += iSrcStep; |
|---|
| 560 | } |
|---|
| 561 | piSrc += iSrcStride; |
|---|
| 562 | piDst += iDstStride; |
|---|
| 563 | } |
|---|
| 564 | return; |
|---|
| 565 | } |
|---|
| 566 | |
|---|
| 567 | __inline Void TRenInterpFilter::xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst) |
|---|
| 568 | { |
|---|
| 569 | Int* piDst = rpiDst; |
|---|
| 570 | Int iSum; |
|---|
| 571 | Pel* piSrcTmp; |
|---|
| 572 | Int iSrcStride2 = iSrcStride*2; |
|---|
| 573 | Int iSrcStride3 = iSrcStride*3; |
|---|
| 574 | Int iSrcStride4 = iSrcStride*4; |
|---|
| 575 | Int iSrcStride5 = iSrcStride*5; |
|---|
| 576 | Int iSrcStride6 = iSrcStride*6; |
|---|
| 577 | Int iSrcStride7 = iSrcStride*7; |
|---|
| 578 | |
|---|
| 579 | Int iTmp1, iTmp2; |
|---|
| 580 | |
|---|
| 581 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 582 | { |
|---|
| 583 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
|---|
| 584 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 585 | { |
|---|
| 586 | /// {-1, 3, -7, 19, 57, -10, 4, -1 }, |
|---|
| 587 | iTmp1 = piSrcTmp[iSrcStride4] + piSrcTmp[iSrcStride2]; |
|---|
| 588 | iTmp2 = piSrcTmp[iSrcStride ] + piSrcTmp[iSrcStride3]; |
|---|
| 589 | |
|---|
| 590 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
|---|
| 591 | - ( ( piSrcTmp[iSrcStride5] - iTmp2 ) << 1 ) |
|---|
| 592 | + ( piSrcTmp[iSrcStride6] << 2 ) |
|---|
| 593 | - ( ( piSrcTmp[iSrcStride5] + iTmp1 ) << 3 ) |
|---|
| 594 | + ( piSrcTmp[iSrcStride3] << 4 ) |
|---|
| 595 | + ( piSrcTmp[iSrcStride4] << 6 ); |
|---|
| 596 | |
|---|
| 597 | piDst[x * iDstStep] = iSum; |
|---|
| 598 | piSrcTmp += iSrcStep; |
|---|
| 599 | } |
|---|
| 600 | piSrc += iSrcStride; |
|---|
| 601 | piDst += iDstStride; |
|---|
| 602 | } |
|---|
| 603 | return; |
|---|
| 604 | } |
|---|
| 605 | |
|---|
| 606 | __inline Void TRenInterpFilter::xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst) |
|---|
| 607 | { |
|---|
| 608 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 609 | |
|---|
| 610 | Pel* piDst = rpiDst; |
|---|
| 611 | Int iSum; |
|---|
| 612 | Pel* piSrcTmp; |
|---|
| 613 | Int iSrcStride2 = iSrcStride*2; |
|---|
| 614 | Int iSrcStride3 = iSrcStride*3; |
|---|
| 615 | Int iSrcStride4 = iSrcStride*4; |
|---|
| 616 | Int iSrcStride5 = iSrcStride*5; |
|---|
| 617 | Int iSrcStride6 = iSrcStride*6; |
|---|
| 618 | Int iSrcStride7 = iSrcStride*7; |
|---|
| 619 | |
|---|
| 620 | Int iTmp1, iTmp2; |
|---|
| 621 | |
|---|
| 622 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 623 | { |
|---|
| 624 | piSrcTmp = &piSrc[ -3*iSrcStride ]; |
|---|
| 625 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 626 | { |
|---|
| 627 | /// {-1, 3, -7, 19, 57, -10, 4, -1 }, |
|---|
| 628 | iTmp1 = piSrcTmp[iSrcStride4] + piSrcTmp[iSrcStride2]; |
|---|
| 629 | iTmp2 = piSrcTmp[iSrcStride ] + piSrcTmp[iSrcStride3]; |
|---|
| 630 | |
|---|
| 631 | iSum = iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7] |
|---|
| 632 | - ( ( piSrcTmp[iSrcStride5] - iTmp2 ) << 1 ) |
|---|
| 633 | + ( piSrcTmp[iSrcStride6] << 2 ) |
|---|
| 634 | - ( ( piSrcTmp[iSrcStride5] + iTmp1 ) << 3 ) |
|---|
| 635 | + ( piSrcTmp[iSrcStride3] << 4 ); |
|---|
| 636 | |
|---|
| 637 | piDst[x * iDstStep] = ClipY( ((iSum + 32) >> 6) + piSrcTmp[iSrcStride4] ); |
|---|
| 638 | piSrcTmp += iSrcStep; |
|---|
| 639 | } |
|---|
| 640 | piSrc += iSrcStride; |
|---|
| 641 | piDst += iDstStride; |
|---|
| 642 | } |
|---|
| 643 | return; |
|---|
| 644 | } |
|---|
| 645 | |
|---|
| 646 | // ------------------------------------------------------------------------------------------------ |
|---|
| 647 | // DCTIF filters for Chroma |
|---|
| 648 | // ------------------------------------------------------------------------------------------------ |
|---|
| 649 | __inline Void TRenInterpFilter::xCTI_Filter2DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Int*& rpiDst, Int iMV) |
|---|
| 650 | { |
|---|
| 651 | Int* piDst = rpiDst; |
|---|
| 652 | Int iSum; |
|---|
| 653 | Pel* piSrcTmp; |
|---|
| 654 | |
|---|
| 655 | switch (iMV) |
|---|
| 656 | { |
|---|
| 657 | case 1: |
|---|
| 658 | { |
|---|
| 659 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 660 | { |
|---|
| 661 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 662 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 663 | { |
|---|
| 664 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, iSrcStride ); |
|---|
| 665 | piDst[x ] = iSum; |
|---|
| 666 | piSrcTmp++; |
|---|
| 667 | } |
|---|
| 668 | piSrc += iSrcStride; |
|---|
| 669 | piDst += iDstStride; |
|---|
| 670 | } |
|---|
| 671 | } |
|---|
| 672 | break; |
|---|
| 673 | case 2: |
|---|
| 674 | { |
|---|
| 675 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 676 | { |
|---|
| 677 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 678 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 679 | { |
|---|
| 680 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, iSrcStride ); |
|---|
| 681 | piDst[x ] = iSum; |
|---|
| 682 | piSrcTmp++; |
|---|
| 683 | } |
|---|
| 684 | piSrc += iSrcStride; |
|---|
| 685 | piDst += iDstStride; |
|---|
| 686 | } |
|---|
| 687 | } |
|---|
| 688 | break; |
|---|
| 689 | case 6: |
|---|
| 690 | { |
|---|
| 691 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 692 | { |
|---|
| 693 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 694 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 695 | { |
|---|
| 696 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, iSrcStride ); |
|---|
| 697 | piDst[x ] = iSum; |
|---|
| 698 | piSrcTmp++; |
|---|
| 699 | } |
|---|
| 700 | piSrc += iSrcStride; |
|---|
| 701 | piDst += iDstStride; |
|---|
| 702 | } |
|---|
| 703 | } |
|---|
| 704 | break; |
|---|
| 705 | case 3: |
|---|
| 706 | { |
|---|
| 707 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 708 | { |
|---|
| 709 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 710 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 711 | { |
|---|
| 712 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, iSrcStride ); |
|---|
| 713 | piDst[x ] = iSum; |
|---|
| 714 | piSrcTmp++; |
|---|
| 715 | } |
|---|
| 716 | piSrc += iSrcStride; |
|---|
| 717 | piDst += iDstStride; |
|---|
| 718 | } |
|---|
| 719 | } |
|---|
| 720 | break; |
|---|
| 721 | case 5: |
|---|
| 722 | { |
|---|
| 723 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 724 | { |
|---|
| 725 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 726 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 727 | { |
|---|
| 728 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, iSrcStride ); |
|---|
| 729 | piDst[x ] = iSum; |
|---|
| 730 | piSrcTmp++; |
|---|
| 731 | } |
|---|
| 732 | piSrc += iSrcStride; |
|---|
| 733 | piDst += iDstStride; |
|---|
| 734 | } |
|---|
| 735 | } |
|---|
| 736 | break; |
|---|
| 737 | case 7: |
|---|
| 738 | { |
|---|
| 739 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 740 | { |
|---|
| 741 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 742 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 743 | { |
|---|
| 744 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, iSrcStride ); |
|---|
| 745 | piDst[x ] = iSum; |
|---|
| 746 | piSrcTmp++; |
|---|
| 747 | } |
|---|
| 748 | piSrc += iSrcStride; |
|---|
| 749 | piDst += iDstStride; |
|---|
| 750 | } |
|---|
| 751 | } |
|---|
| 752 | break; |
|---|
| 753 | case 4: |
|---|
| 754 | { |
|---|
| 755 | |
|---|
| 756 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 757 | { |
|---|
| 758 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 759 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 760 | { |
|---|
| 761 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride ); |
|---|
| 762 | piDst[x ] = iSum; |
|---|
| 763 | piSrcTmp++; |
|---|
| 764 | } |
|---|
| 765 | piSrc += iSrcStride; |
|---|
| 766 | piDst += iDstStride; |
|---|
| 767 | } |
|---|
| 768 | } |
|---|
| 769 | break; |
|---|
| 770 | default: |
|---|
| 771 | assert( 0 ); |
|---|
| 772 | } |
|---|
| 773 | return; |
|---|
| 774 | } |
|---|
| 775 | |
|---|
| 776 | __inline Void TRenInterpFilter::xCTI_Filter2DHorC(Int* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
|---|
| 777 | { |
|---|
| 778 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 779 | Pel* piDst = rpiDst; |
|---|
| 780 | Int iSum; |
|---|
| 781 | Int* piSrcTmp; |
|---|
| 782 | |
|---|
| 783 | switch (iMV) |
|---|
| 784 | { |
|---|
| 785 | case 1: |
|---|
| 786 | { |
|---|
| 787 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 788 | { |
|---|
| 789 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 790 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 791 | { |
|---|
| 792 | iSum = xCTI_Filter_VI04_C_OCT0( piSrcTmp, 1 ); |
|---|
| 793 | piDst [x ] = ClipC ((iSum + 2048) >> 12 ); |
|---|
| 794 | piSrcTmp++; |
|---|
| 795 | } |
|---|
| 796 | piSrc += iSrcStride; |
|---|
| 797 | piDst += iDstStride; |
|---|
| 798 | } |
|---|
| 799 | } |
|---|
| 800 | break; |
|---|
| 801 | case 2: |
|---|
| 802 | { |
|---|
| 803 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 804 | { |
|---|
| 805 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 806 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 807 | { |
|---|
| 808 | iSum = xCTI_Filter_VI04_C_QUA0( piSrcTmp, 1 ); |
|---|
| 809 | piDst [x ] = ClipC ((iSum + 2048) >> 12 ); |
|---|
| 810 | piSrcTmp++; |
|---|
| 811 | } |
|---|
| 812 | piSrc += iSrcStride; |
|---|
| 813 | piDst += iDstStride; |
|---|
| 814 | } |
|---|
| 815 | } |
|---|
| 816 | break; |
|---|
| 817 | case 6: |
|---|
| 818 | { |
|---|
| 819 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 820 | { |
|---|
| 821 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 822 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 823 | { |
|---|
| 824 | iSum = xCTI_Filter_VI04_C_QUA1( piSrcTmp, 1 ); |
|---|
| 825 | piDst [x ] = ClipC ((iSum + 2048) >> 12 ); |
|---|
| 826 | piSrcTmp++; |
|---|
| 827 | } |
|---|
| 828 | piSrc += iSrcStride; |
|---|
| 829 | piDst += iDstStride; |
|---|
| 830 | } |
|---|
| 831 | } |
|---|
| 832 | break; |
|---|
| 833 | case 3: |
|---|
| 834 | { |
|---|
| 835 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 836 | { |
|---|
| 837 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 838 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 839 | { |
|---|
| 840 | iSum = xCTI_Filter_VI04_C_OCT1( piSrcTmp, 1 ); |
|---|
| 841 | piDst [x ] = ClipC ((iSum + 2048) >> 12 ); |
|---|
| 842 | piSrcTmp++; |
|---|
| 843 | } |
|---|
| 844 | piSrc += iSrcStride; |
|---|
| 845 | piDst += iDstStride; |
|---|
| 846 | } |
|---|
| 847 | } |
|---|
| 848 | break; |
|---|
| 849 | case 5: |
|---|
| 850 | { |
|---|
| 851 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 852 | { |
|---|
| 853 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 854 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 855 | { |
|---|
| 856 | iSum = xCTI_Filter_VI04_C_OCT2( piSrcTmp, 1 ); |
|---|
| 857 | piDst [x ] = ClipC ((iSum + 2048) >> 12 ); |
|---|
| 858 | piSrcTmp++; |
|---|
| 859 | } |
|---|
| 860 | piSrc += iSrcStride; |
|---|
| 861 | piDst += iDstStride; |
|---|
| 862 | } |
|---|
| 863 | } |
|---|
| 864 | break; |
|---|
| 865 | case 7: |
|---|
| 866 | { |
|---|
| 867 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 868 | { |
|---|
| 869 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 870 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 871 | { |
|---|
| 872 | iSum = xCTI_Filter_VI04_C_OCT3( piSrcTmp, 1 ); |
|---|
| 873 | piDst [x ] = ClipC ((iSum + 2048) >> 12 ); |
|---|
| 874 | piSrcTmp++; |
|---|
| 875 | } |
|---|
| 876 | piSrc += iSrcStride; |
|---|
| 877 | piDst += iDstStride; |
|---|
| 878 | } |
|---|
| 879 | } |
|---|
| 880 | break; |
|---|
| 881 | case 4: |
|---|
| 882 | { |
|---|
| 883 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 884 | { |
|---|
| 885 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 886 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 887 | { |
|---|
| 888 | iSum = xCTI_Filter_VIS04_C_HAL( piSrcTmp, 1 ); |
|---|
| 889 | piDst [x ] = ClipC ((iSum + 2048) >> 12 ); |
|---|
| 890 | piSrcTmp++; |
|---|
| 891 | } |
|---|
| 892 | piSrc += iSrcStride; |
|---|
| 893 | piDst += iDstStride; |
|---|
| 894 | } |
|---|
| 895 | } |
|---|
| 896 | break; |
|---|
| 897 | default: |
|---|
| 898 | assert( 0 ); |
|---|
| 899 | } |
|---|
| 900 | |
|---|
| 901 | return; |
|---|
| 902 | } |
|---|
| 903 | |
|---|
| 904 | __inline Void TRenInterpFilter::xCTI_Filter1DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
|---|
| 905 | { |
|---|
| 906 | assert( g_bitDepthC == g_bitDepthY); // ToDo: Update renderer to work with different luma/chroma bit depth |
|---|
| 907 | |
|---|
| 908 | Pel* piDst = rpiDst; |
|---|
| 909 | Int iSum; |
|---|
| 910 | Pel* piSrcTmp; |
|---|
| 911 | |
|---|
| 912 | switch (iMV) |
|---|
| 913 | { |
|---|
| 914 | case 1: |
|---|
| 915 | { |
|---|
| 916 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 917 | { |
|---|
| 918 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 919 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 920 | { |
|---|
| 921 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, iSrcStride ); |
|---|
| 922 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 923 | piSrcTmp++; |
|---|
| 924 | } |
|---|
| 925 | piSrc += iSrcStride; |
|---|
| 926 | piDst += iDstStride; |
|---|
| 927 | } |
|---|
| 928 | } |
|---|
| 929 | break; |
|---|
| 930 | case 2: |
|---|
| 931 | { |
|---|
| 932 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 933 | { |
|---|
| 934 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 935 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 936 | { |
|---|
| 937 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, iSrcStride ); |
|---|
| 938 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 939 | piSrcTmp++; |
|---|
| 940 | } |
|---|
| 941 | piSrc += iSrcStride; |
|---|
| 942 | piDst += iDstStride; |
|---|
| 943 | } |
|---|
| 944 | } |
|---|
| 945 | break; |
|---|
| 946 | case 6: |
|---|
| 947 | { |
|---|
| 948 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 949 | { |
|---|
| 950 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 951 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 952 | { |
|---|
| 953 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, iSrcStride ); |
|---|
| 954 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 955 | piSrcTmp++; |
|---|
| 956 | } |
|---|
| 957 | piSrc += iSrcStride; |
|---|
| 958 | piDst += iDstStride; |
|---|
| 959 | } |
|---|
| 960 | } |
|---|
| 961 | break; |
|---|
| 962 | case 3: |
|---|
| 963 | { |
|---|
| 964 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 965 | { |
|---|
| 966 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 967 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 968 | { |
|---|
| 969 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, iSrcStride ); |
|---|
| 970 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 971 | piSrcTmp++; |
|---|
| 972 | } |
|---|
| 973 | piSrc += iSrcStride; |
|---|
| 974 | piDst += iDstStride; |
|---|
| 975 | } |
|---|
| 976 | } |
|---|
| 977 | break; |
|---|
| 978 | case 5: |
|---|
| 979 | { |
|---|
| 980 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 981 | { |
|---|
| 982 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 983 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 984 | { |
|---|
| 985 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, iSrcStride ); |
|---|
| 986 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 987 | piSrcTmp++; |
|---|
| 988 | } |
|---|
| 989 | piSrc += iSrcStride; |
|---|
| 990 | piDst += iDstStride; |
|---|
| 991 | } |
|---|
| 992 | } |
|---|
| 993 | break; |
|---|
| 994 | case 7: |
|---|
| 995 | { |
|---|
| 996 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 997 | { |
|---|
| 998 | piSrcTmp = &piSrc[ -iSrcStride ]; |
|---|
| 999 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1000 | { |
|---|
| 1001 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, iSrcStride ); |
|---|
| 1002 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1003 | piSrcTmp++; |
|---|
| 1004 | } |
|---|
| 1005 | piSrc += iSrcStride; |
|---|
| 1006 | piDst += iDstStride; |
|---|
| 1007 | } |
|---|
| 1008 | } |
|---|
| 1009 | break; |
|---|
| 1010 | case 4: |
|---|
| 1011 | { |
|---|
| 1012 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1013 | { |
|---|
| 1014 | piSrcTmp = &piSrc[-iSrcStride ]; |
|---|
| 1015 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1016 | { |
|---|
| 1017 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride ); |
|---|
| 1018 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1019 | piSrcTmp++; |
|---|
| 1020 | } |
|---|
| 1021 | piSrc += iSrcStride; |
|---|
| 1022 | piDst += iDstStride; |
|---|
| 1023 | } |
|---|
| 1024 | } |
|---|
| 1025 | break; |
|---|
| 1026 | default: |
|---|
| 1027 | assert( 0 ); |
|---|
| 1028 | } |
|---|
| 1029 | return; |
|---|
| 1030 | } |
|---|
| 1031 | |
|---|
| 1032 | __inline Void TRenInterpFilter::xCTI_Filter1DHorC(Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV) |
|---|
| 1033 | { |
|---|
| 1034 | Pel* piDst = rpiDst; |
|---|
| 1035 | Int iSum; |
|---|
| 1036 | Pel* piSrcTmp; |
|---|
| 1037 | |
|---|
| 1038 | switch (iMV) |
|---|
| 1039 | { |
|---|
| 1040 | case 1: |
|---|
| 1041 | { |
|---|
| 1042 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1043 | { |
|---|
| 1044 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 1045 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1046 | { |
|---|
| 1047 | iSum = xCTI_Filter_VP04_C_OCT0( piSrcTmp, 1 ); |
|---|
| 1048 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1049 | piSrcTmp++; |
|---|
| 1050 | } |
|---|
| 1051 | piSrc += iSrcStride; |
|---|
| 1052 | piDst += iDstStride; |
|---|
| 1053 | } |
|---|
| 1054 | } |
|---|
| 1055 | break; |
|---|
| 1056 | case 2: |
|---|
| 1057 | { |
|---|
| 1058 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1059 | { |
|---|
| 1060 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 1061 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1062 | { |
|---|
| 1063 | iSum = xCTI_Filter_VP04_C_QUA0( piSrcTmp, 1 ); |
|---|
| 1064 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1065 | piSrcTmp++; |
|---|
| 1066 | } |
|---|
| 1067 | piSrc += iSrcStride; |
|---|
| 1068 | piDst += iDstStride; |
|---|
| 1069 | } |
|---|
| 1070 | } |
|---|
| 1071 | break; |
|---|
| 1072 | case 6: |
|---|
| 1073 | { |
|---|
| 1074 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1075 | { |
|---|
| 1076 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 1077 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1078 | { |
|---|
| 1079 | iSum = xCTI_Filter_VP04_C_QUA1( piSrcTmp, 1 ); |
|---|
| 1080 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1081 | piSrcTmp++; |
|---|
| 1082 | } |
|---|
| 1083 | piSrc += iSrcStride; |
|---|
| 1084 | piDst += iDstStride; |
|---|
| 1085 | } |
|---|
| 1086 | } |
|---|
| 1087 | break; |
|---|
| 1088 | case 3: |
|---|
| 1089 | { |
|---|
| 1090 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1091 | { |
|---|
| 1092 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 1093 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1094 | { |
|---|
| 1095 | iSum = xCTI_Filter_VP04_C_OCT1( piSrcTmp, 1 ); |
|---|
| 1096 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1097 | piSrcTmp++; |
|---|
| 1098 | } |
|---|
| 1099 | piSrc += iSrcStride; |
|---|
| 1100 | piDst += iDstStride; |
|---|
| 1101 | } |
|---|
| 1102 | } |
|---|
| 1103 | break; |
|---|
| 1104 | case 5: |
|---|
| 1105 | { |
|---|
| 1106 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1107 | { |
|---|
| 1108 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 1109 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1110 | { |
|---|
| 1111 | iSum = xCTI_Filter_VP04_C_OCT2( piSrcTmp, 1 ); |
|---|
| 1112 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1113 | piSrcTmp++; |
|---|
| 1114 | } |
|---|
| 1115 | piSrc += iSrcStride; |
|---|
| 1116 | piDst += iDstStride; |
|---|
| 1117 | } |
|---|
| 1118 | } |
|---|
| 1119 | break; |
|---|
| 1120 | case 7: |
|---|
| 1121 | { |
|---|
| 1122 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1123 | { |
|---|
| 1124 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 1125 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1126 | { |
|---|
| 1127 | iSum = xCTI_Filter_VP04_C_OCT3( piSrcTmp, 1 ); |
|---|
| 1128 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1129 | piSrcTmp++; |
|---|
| 1130 | } |
|---|
| 1131 | piSrc += iSrcStride; |
|---|
| 1132 | piDst += iDstStride; |
|---|
| 1133 | } |
|---|
| 1134 | } |
|---|
| 1135 | break; |
|---|
| 1136 | case 4: |
|---|
| 1137 | { |
|---|
| 1138 | for ( Int y = iHeight; y != 0; y-- ) |
|---|
| 1139 | { |
|---|
| 1140 | piSrcTmp = &piSrc[ -1 ]; |
|---|
| 1141 | for ( Int x = 0; x < iWidth; x++ ) |
|---|
| 1142 | { |
|---|
| 1143 | iSum = xCTI_Filter_VPS04_C_HAL( piSrcTmp, 1 ); |
|---|
| 1144 | piDst[x ] = ClipC ((iSum + 32) >> 6 ); |
|---|
| 1145 | piSrcTmp++; |
|---|
| 1146 | } |
|---|
| 1147 | piSrc += iSrcStride; |
|---|
| 1148 | piDst += iDstStride; |
|---|
| 1149 | } |
|---|
| 1150 | } |
|---|
| 1151 | break; |
|---|
| 1152 | default: |
|---|
| 1153 | assert( 0 ); |
|---|
| 1154 | } |
|---|
| 1155 | return; |
|---|
| 1156 | } |
|---|
| 1157 | |
|---|
| 1158 | __inline Int TRenInterpFilter::xCTI_Filter_VP04_C_OCT0( Pel* pSrc, Int iStride ) |
|---|
| 1159 | {// { -3, 60, 8, -1,} // 1/8 |
|---|
| 1160 | Int iSum, iIdx = 0; |
|---|
| 1161 | |
|---|
| 1162 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1163 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1164 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1165 | Int p3 = pSrc[iIdx]; |
|---|
| 1166 | iSum = (p1<<6) -((p1+p0)<<2) +p0 +(p2<<3) -p3; |
|---|
| 1167 | |
|---|
| 1168 | return iSum; |
|---|
| 1169 | } |
|---|
| 1170 | __inline Int TRenInterpFilter::xCTI_Filter_VI04_C_OCT0( Int* pSrc, Int iStride ) |
|---|
| 1171 | { // { -3, 60, 8, -1,} //1/8 |
|---|
| 1172 | Int iSum, iIdx = 0; |
|---|
| 1173 | |
|---|
| 1174 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1175 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1176 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1177 | Int p3 = pSrc[iIdx]; |
|---|
| 1178 | iSum = (p1<<6) -((p1+p0)<<2) +p0 +(p2<<3) -p3; |
|---|
| 1179 | |
|---|
| 1180 | return iSum; |
|---|
| 1181 | } |
|---|
| 1182 | __inline Int TRenInterpFilter::xCTI_Filter_VP04_C_QUA0( Pel* pSrc, Int iStride ) |
|---|
| 1183 | {// { -4, 54, 16, -2,} // 1/4 |
|---|
| 1184 | Int iSum, iIdx = 0; |
|---|
| 1185 | |
|---|
| 1186 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1187 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1188 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1189 | Int p3 = pSrc[iIdx]; |
|---|
| 1190 | iSum = (p1 << 6) + (p2 << 4) - (p1 << 3) - ( p0 << 2) - ((p1 + p3) << 1); |
|---|
| 1191 | |
|---|
| 1192 | return iSum; |
|---|
| 1193 | } |
|---|
| 1194 | __inline Int TRenInterpFilter::xCTI_Filter_VI04_C_QUA0( Int* pSrc, Int iStride ) |
|---|
| 1195 | { // { -4, 54, 16, -2,} //1/4 |
|---|
| 1196 | Int iSum, iIdx = 0; |
|---|
| 1197 | |
|---|
| 1198 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1199 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1200 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1201 | Int p3 = pSrc[iIdx]; |
|---|
| 1202 | iSum = (p1 << 6) + (p2 << 4) - (p1 << 3) - ( p0 << 2) - ((p1 + p3) << 1); |
|---|
| 1203 | |
|---|
| 1204 | return iSum; |
|---|
| 1205 | } |
|---|
| 1206 | __inline Int TRenInterpFilter::xCTI_Filter_VP04_C_QUA1( Pel* pSrc, Int iStride ) |
|---|
| 1207 | {// { -2, 16, 54, -4,}// 3/4 |
|---|
| 1208 | Int iSum, iIdx = 0; |
|---|
| 1209 | |
|---|
| 1210 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1211 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1212 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1213 | Int p3 = pSrc[iIdx]; |
|---|
| 1214 | iSum = (p2 << 6) + (p1 << 4) - (p2 << 3) - ( p3 << 2) - ((p2 + p0) << 1); |
|---|
| 1215 | |
|---|
| 1216 | return iSum; |
|---|
| 1217 | } |
|---|
| 1218 | __inline Int TRenInterpFilter::xCTI_Filter_VI04_C_QUA1( Int* pSrc, Int iStride ) |
|---|
| 1219 | {// { -2, 16, 54, -4,}// 3/4 |
|---|
| 1220 | Int iSum, iIdx = 0; |
|---|
| 1221 | |
|---|
| 1222 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1223 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1224 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1225 | Int p3 = pSrc[iIdx]; |
|---|
| 1226 | iSum = (p2 << 6) + (p1 << 4) - (p2 << 3) - ( p3 << 2) - ((p2 + p0) << 1); |
|---|
| 1227 | |
|---|
| 1228 | return iSum; |
|---|
| 1229 | } |
|---|
| 1230 | __inline Int TRenInterpFilter::xCTI_Filter_VP04_C_OCT1( Pel* pSrc, Int iStride ) |
|---|
| 1231 | {// { -5, 46, 27, -4,} // 3/8 |
|---|
| 1232 | Int iSum, iIdx = 0; |
|---|
| 1233 | |
|---|
| 1234 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1235 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1236 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1237 | Int p3 = pSrc[iIdx]; |
|---|
| 1238 | Int t = p0 + p2; |
|---|
| 1239 | iSum = ((p1 + p2) << 5) + (p1 << 4) - ( (t + p3) << 2) - ( p1 << 1) - t; |
|---|
| 1240 | |
|---|
| 1241 | return iSum; |
|---|
| 1242 | } |
|---|
| 1243 | __inline Int TRenInterpFilter::xCTI_Filter_VI04_C_OCT1( Int* pSrc, Int iStride ) |
|---|
| 1244 | { // { -5, 46, 27, -4,} //3/8 |
|---|
| 1245 | Int iSum, iIdx = 0; |
|---|
| 1246 | |
|---|
| 1247 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1248 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1249 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1250 | Int p3 = pSrc[iIdx]; |
|---|
| 1251 | Int t = p0 + p2; |
|---|
| 1252 | iSum = ((p1 + p2) << 5) + (p1 << 4) - ( (t + p3) << 2) - ( p1 << 1) - t; |
|---|
| 1253 | |
|---|
| 1254 | return iSum; |
|---|
| 1255 | } |
|---|
| 1256 | __inline Int TRenInterpFilter::xCTI_Filter_VPS04_C_HAL( Pel* pSrc, Int iStride ) |
|---|
| 1257 | { |
|---|
| 1258 | // { -4, 36, 36, -4,}, // 1/2 |
|---|
| 1259 | Int iSum; |
|---|
| 1260 | Int iTemp0 = pSrc[iStride*1]+pSrc[iStride*2]; |
|---|
| 1261 | Int iTemp1 = pSrc[ 0]+pSrc[iStride*3]; |
|---|
| 1262 | |
|---|
| 1263 | iSum = ((iTemp0<<3) + iTemp0 -iTemp1)<<2; |
|---|
| 1264 | |
|---|
| 1265 | return iSum; |
|---|
| 1266 | } |
|---|
| 1267 | __inline Int TRenInterpFilter::xCTI_Filter_VIS04_C_HAL( Int* pSrc, Int iStride ) |
|---|
| 1268 | { |
|---|
| 1269 | // { -4, 36, 36, -4,}, //1/2 |
|---|
| 1270 | Int iSum; |
|---|
| 1271 | Int iTemp0 = pSrc[iStride*1]+pSrc[iStride*2]; |
|---|
| 1272 | Int iTemp1 = pSrc[ 0]+pSrc[iStride*3]; |
|---|
| 1273 | |
|---|
| 1274 | iSum = ((iTemp0<<3) + iTemp0 -iTemp1)<<2; |
|---|
| 1275 | |
|---|
| 1276 | return iSum; |
|---|
| 1277 | } |
|---|
| 1278 | __inline Int TRenInterpFilter::xCTI_Filter_VP04_C_OCT2( Pel* pSrc, Int iStride ) |
|---|
| 1279 | {// { -4, 27, 46, -5,}, // 5/8 |
|---|
| 1280 | Int iSum, iIdx = 0; |
|---|
| 1281 | |
|---|
| 1282 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1283 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1284 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1285 | Int p3 = pSrc[iIdx]; |
|---|
| 1286 | Int t = p1 + p3; |
|---|
| 1287 | iSum = ((p1 + p2) << 5) + (p2 << 4) - ( (t + p0) << 2) - ( p2 << 1) - t; |
|---|
| 1288 | |
|---|
| 1289 | return iSum; |
|---|
| 1290 | } |
|---|
| 1291 | __inline Int TRenInterpFilter::xCTI_Filter_VI04_C_OCT2( Int* pSrc, Int iStride ) |
|---|
| 1292 | { // { -4, 27, 46, -5,}, // 5/8 |
|---|
| 1293 | Int iSum, iIdx = 0; |
|---|
| 1294 | |
|---|
| 1295 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1296 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1297 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1298 | Int p3 = pSrc[iIdx]; |
|---|
| 1299 | Int t = p1 + p3; |
|---|
| 1300 | iSum = ((p1 + p2) << 5) + (p2 << 4) - ( (t + p0) << 2) - ( p2 << 1) - t; |
|---|
| 1301 | |
|---|
| 1302 | return iSum; |
|---|
| 1303 | } |
|---|
| 1304 | __inline Int TRenInterpFilter::xCTI_Filter_VP04_C_OCT3( Pel* pSrc, Int iStride ) |
|---|
| 1305 | {// { -1, 8, 60, -3,} // 7/8 |
|---|
| 1306 | Int iSum, iIdx = 0; |
|---|
| 1307 | |
|---|
| 1308 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1309 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1310 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1311 | Int p3 = pSrc[iIdx]; |
|---|
| 1312 | iSum = (p2<<6) -((p2+p3)<<2) +p3 +(p1<<3) -p0; |
|---|
| 1313 | |
|---|
| 1314 | return iSum; |
|---|
| 1315 | } |
|---|
| 1316 | __inline Int TRenInterpFilter::xCTI_Filter_VI04_C_OCT3( Int* pSrc, Int iStride ) |
|---|
| 1317 | { // { -1, 8, 60, -3,} // 7/8 |
|---|
| 1318 | Int iSum, iIdx = 0; |
|---|
| 1319 | |
|---|
| 1320 | Int p0 = pSrc[0]; iIdx+= iStride; |
|---|
| 1321 | Int p1 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1322 | Int p2 = pSrc[iIdx]; iIdx+= iStride; |
|---|
| 1323 | Int p3 = pSrc[iIdx]; |
|---|
| 1324 | iSum = (p2<<6) -((p2+p3)<<2) +p3 +(p1<<3) -p0; |
|---|
| 1325 | |
|---|
| 1326 | return iSum; |
|---|
| 1327 | } |
|---|
| 1328 | #endif // H_3D |
|---|
| 1329 | #endif // __TRENINTERP__ |
|---|