00001
00023 #include "global.h"
00024 #include "image.h"
00025 #include "mb_access.h"
00026 #include "loopfilter.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 static const byte ALPHA_TABLE[52] = {0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,4,4,5,6, 7,8,9,10,12,13,15,17, 20,22,25,28,32,36,40,45, 50,56,63,71,80,90,101,113, 127,144,162,182,203,226,255,255} ;
00039 static const byte BETA_TABLE[52] = {0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,2,2,2,3, 3,3,3, 4, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 11,11,12,12,13,13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18} ;
00040 static const byte CLIP_TAB[52][5] =
00041 {
00042 { 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},
00043 { 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},{ 0, 0, 0, 0, 0},
00044 { 0, 0, 0, 0, 0},{ 0, 0, 0, 1, 1},{ 0, 0, 0, 1, 1},{ 0, 0, 0, 1, 1},{ 0, 0, 0, 1, 1},{ 0, 0, 1, 1, 1},{ 0, 0, 1, 1, 1},{ 0, 1, 1, 1, 1},
00045 { 0, 1, 1, 1, 1},{ 0, 1, 1, 1, 1},{ 0, 1, 1, 1, 1},{ 0, 1, 1, 2, 2},{ 0, 1, 1, 2, 2},{ 0, 1, 1, 2, 2},{ 0, 1, 1, 2, 2},{ 0, 1, 2, 3, 3},
00046 { 0, 1, 2, 3, 3},{ 0, 2, 2, 3, 3},{ 0, 2, 2, 4, 4},{ 0, 2, 3, 4, 4},{ 0, 2, 3, 4, 4},{ 0, 3, 3, 5, 5},{ 0, 3, 4, 6, 6},{ 0, 3, 4, 6, 6},
00047 { 0, 4, 5, 7, 7},{ 0, 4, 5, 8, 8},{ 0, 4, 6, 9, 9},{ 0, 5, 7,10,10},{ 0, 6, 8,11,11},{ 0, 6, 8,13,13},{ 0, 7,10,14,14},{ 0, 8,11,16,16},
00048 { 0, 9,12,18,18},{ 0,10,13,20,20},{ 0,11,15,23,23},{ 0,13,17,25,25}
00049 } ;
00050
00051 static const char chroma_edge[2][4][4] =
00052 { { {-4, 0, 0, 0},
00053 {-4,-4,-4, 4},
00054 {-4, 4, 4, 8},
00055 {-4,-4,-4, 12}},
00056
00057 { {-4, 0, 0, 0},
00058 {-4,-4, 4, 4},
00059 {-4, 4, 8, 8},
00060 {-4,-4, 12, 12}}};
00061
00062 static const int pelnum_cr[2][4] = {{0,8,16,16}, {0,8, 8,16}};
00063
00064
00065 void GetStrengthNormal (byte Strength[MB_BLOCK_SIZE], Macroblock *MbQ, int dir,int edge, int mvlimit,StorablePicture *p);
00066 void GetStrengthMBAff (byte Strength[MB_BLOCK_SIZE], Macroblock *MbQ, int dir,int edge, int mvlimit,StorablePicture *p);
00067 void EdgeLoopLumaNormal(ColorPlane pl, imgpel** Img, byte Strength[16],Macroblock *MbQ, int dir, int edge, StorablePicture *p);
00068 void EdgeLoopLumaMBAff (ColorPlane pl, imgpel** Img, byte Strength[16],Macroblock *MbQ, int dir, int edge, StorablePicture *p);
00069 void EdgeLoopChromaNormal(imgpel** Img, byte Strength[16],Macroblock *MbQ, int dir, int edge, int uv, StorablePicture *p);
00070 void EdgeLoopChromaMBAff(imgpel** Img, byte Strength[16],Macroblock *MbQ, int dir, int edge, int uv, StorablePicture *p);
00071 void DeblockMb(ImageParameters *p_Img, StorablePicture *p, int MbQAddr);
00072 int compute_deblock_strength(char **list0_refIdxArr, char **list1_refIdxArr, int64 **list0_refPicIdArr, int64 **list1_refPicIdArr,
00073 short ***list0_mv, short ***list1_mv, int blk_y, int blk_x, int blk_y2, int blk_x2, int mvlimit);
00074
00081 void DeblockPicture(ImageParameters *p_Img, StorablePicture *p)
00082 {
00083 unsigned i;
00084
00085 if (p->MbaffFrameFlag == 1)
00086 {
00087 p_Img->GetStrength = GetStrengthMBAff;
00088 p_Img->EdgeLoopLuma = EdgeLoopLumaMBAff;
00089 p_Img->EdgeLoopChroma = EdgeLoopChromaMBAff;
00090 }
00091 else
00092 {
00093 p_Img->GetStrength = GetStrengthNormal;
00094 p_Img->EdgeLoopLuma = EdgeLoopLumaNormal;
00095 p_Img->EdgeLoopChroma = EdgeLoopChromaNormal;
00096 }
00097
00098 for (i = 0; i < p->PicSizeInMbs; ++i)
00099 {
00100 DeblockMb( p_Img, p, i ) ;
00101 }
00102 }
00103
00104
00112 void DeblockMb(ImageParameters *p_Img, StorablePicture *p, int MbQAddr)
00113 {
00114 int EdgeCondition;
00115 int dir, edge;
00116 byte Strength[16];
00117 short mb_x, mb_y;
00118
00119 int filterNon8x8LumaEdgesFlag[4] = {1,1,1,1};
00120 int filterLeftMbEdgeFlag;
00121 int filterTopMbEdgeFlag;
00122 int fieldModeMbFlag;
00123 int mvlimit = 4;
00124 int i, StrengthSum;
00125 Macroblock *MbQ = &(p_Img->mb_data[MbQAddr]) ;
00126 imgpel **imgY = p->imgY;
00127 imgpel ***imgUV = p->imgUV;
00128
00129 int edge_cr;
00130
00131
00132 if (MbQ->DFDisableIdc==1)
00133 {
00134 p_Img->DeblockCall = 0;
00135 return;
00136 }
00137
00138 p_Img->DeblockCall = 1;
00139 get_mb_pos (p_Img, MbQAddr, p_Img->mb_size[IS_LUMA], &mb_x, &mb_y);
00140
00141 filterLeftMbEdgeFlag = (mb_x != 0);
00142 filterTopMbEdgeFlag = (mb_y != 0);
00143
00144 if (MbQ->mb_type == I8MB)
00145 assert(MbQ->luma_transform_size_8x8_flag);
00146
00147 filterNon8x8LumaEdgesFlag[1] =
00148 filterNon8x8LumaEdgesFlag[3] = !(MbQ->luma_transform_size_8x8_flag);
00149
00150 if (p->MbaffFrameFlag && mb_y == MB_BLOCK_SIZE && MbQ->mb_field)
00151 filterTopMbEdgeFlag = 0;
00152
00153 fieldModeMbFlag = (p->structure!=FRAME) || (p->MbaffFrameFlag && MbQ->mb_field);
00154 if (fieldModeMbFlag)
00155 mvlimit = 2;
00156
00157 if (MbQ->DFDisableIdc==2)
00158 {
00159
00160 filterLeftMbEdgeFlag = MbQ->mbAvailA;
00161
00162 filterTopMbEdgeFlag = (p->MbaffFrameFlag && !MbQ->mb_field && (MbQAddr & 0x01)) ? 1 : MbQ->mbAvailB;
00163 }
00164
00165 CheckAvailabilityOfNeighbors(MbQ);
00166
00167 for( dir = 0 ; dir < 2 ; ++dir )
00168 {
00169 EdgeCondition = (dir && filterTopMbEdgeFlag) || (!dir && filterLeftMbEdgeFlag);
00170 for( edge=0; edge<4 ; ++edge )
00171 {
00172 if( edge || EdgeCondition )
00173 {
00174 edge_cr = chroma_edge[dir][edge][p->chroma_format_idc];
00175
00176 p_Img->GetStrength(Strength, MbQ, dir, edge << 2, mvlimit, p);
00177 StrengthSum = Strength[0];
00178 for (i = 1; i < MB_BLOCK_SIZE && StrengthSum == 0 ; ++i)
00179 {
00180 StrengthSum += (int) Strength[i];
00181 }
00182
00183 if( StrengthSum )
00184 {
00185 if (filterNon8x8LumaEdgesFlag[edge])
00186 {
00187 p_Img->EdgeLoopLuma( PLANE_Y, imgY, Strength, MbQ, dir, edge << 2, p) ;
00188 if( p_Img->active_sps->chroma_format_idc==YUV444 && !IS_INDEPENDENT(p_Img) )
00189 {
00190 p_Img->EdgeLoopLuma(PLANE_U, imgUV[0], Strength, MbQ, dir, edge << 2, p);
00191 p_Img->EdgeLoopLuma(PLANE_V, imgUV[1], Strength, MbQ, dir, edge << 2, p);
00192 }
00193 }
00194 if (p_Img->active_sps->chroma_format_idc==YUV420 || p_Img->active_sps->chroma_format_idc==YUV422)
00195 {
00196 if( (imgUV != NULL) && (edge_cr >= 0))
00197 {
00198 p_Img->EdgeLoopChroma( imgUV[0], Strength, MbQ, dir, edge_cr, 0, p);
00199 p_Img->EdgeLoopChroma( imgUV[1], Strength, MbQ, dir, edge_cr, 1, p);
00200 }
00201 }
00202 }
00203
00204 if (dir && !edge && !MbQ->mb_field && p_Img->mixedModeEdgeFlag)
00205 {
00206
00207 p_Img->DeblockCall = 2;
00208 p_Img->GetStrength(Strength, MbQ, dir, MB_BLOCK_SIZE, mvlimit, p);
00209
00210 {
00211 if (filterNon8x8LumaEdgesFlag[edge])
00212 {
00213 p_Img->EdgeLoopLuma(PLANE_Y, imgY, Strength, MbQ, dir, MB_BLOCK_SIZE, p) ;
00214 if( p_Img->active_sps->chroma_format_idc==YUV444 && !IS_INDEPENDENT(p_Img) )
00215 {
00216 p_Img->EdgeLoopLuma(PLANE_U, imgUV[0], Strength, MbQ, dir, MB_BLOCK_SIZE, p) ;
00217 p_Img->EdgeLoopLuma(PLANE_V, imgUV[1], Strength, MbQ, dir, MB_BLOCK_SIZE, p) ;
00218 }
00219 }
00220 if (p_Img->active_sps->chroma_format_idc==YUV420 || p_Img->active_sps->chroma_format_idc==YUV422)
00221 {
00222 if( (imgUV != NULL) && (edge_cr >= 0))
00223 {
00224 p_Img->EdgeLoopChroma( imgUV[0], Strength, MbQ, dir, MB_BLOCK_SIZE, 0, p) ;
00225 p_Img->EdgeLoopChroma( imgUV[1], Strength, MbQ, dir, MB_BLOCK_SIZE, 1, p) ;
00226 }
00227 }
00228 }
00229 p_Img->DeblockCall = 1;
00230 }
00231 }
00232 }
00233 }
00234
00235 p_Img->DeblockCall = 0;
00236 }
00237
00238 #define ANY_INTRA (MbP->mb_type==I4MB||MbP->mb_type==I8MB||MbP->mb_type==I16MB||MbP->mb_type==IPCM||MbQ->mb_type==I4MB||MbQ->mb_type==I8MB||MbQ->mb_type==I16MB||MbQ->mb_type==IPCM)
00239
00246 void GetStrengthNormal(byte Strength[MB_BLOCK_SIZE], Macroblock *MbQ, int dir, int edge, int mvlimit, StorablePicture *p)
00247 {
00248 PixelPos pixP, pixMB;
00249 byte StrValue;
00250 Macroblock *MbP;
00251
00252 if ((p->slice_type==SP_SLICE)||(p->slice_type==SI_SLICE) )
00253 {
00254
00255 StrValue = (edge == 0 && (((p->structure==FRAME)) || ((p->structure != FRAME) && !dir))) ? 4 : 3;
00256 memset(&Strength[0], (byte) StrValue, MB_BLOCK_SIZE * sizeof(byte));
00257 }
00258 else
00259 {
00260 ImageParameters *p_Img = MbQ->p_Img;
00261 int xQ = dir ? 0 : edge - 1;
00262 int yQ = dir ? (edge < 16 ? edge - 1: 0) : 0;
00263
00264 p_Img->getNeighbour(MbQ, xQ, yQ, p_Img->mb_size[IS_LUMA], &pixMB);
00265 pixP = pixMB;
00266 MbP = &(p_Img->mb_data[pixP.mb_addr]);
00267
00268 if (!ANY_INTRA)
00269 {
00270 PicMotionParams *motion = &p->motion;
00271 int64 ref_p0,ref_p1,ref_q0,ref_q1;
00272 int blkP, blkQ, idx;
00273 int blk_x, blk_x2, blk_y, blk_y2 ;
00274
00275 int64 **list0_refPicIdArr = motion->ref_pic_id[LIST_0];
00276 int64 **list1_refPicIdArr = motion->ref_pic_id[LIST_1];
00277 short ***list0_mv = motion->mv[LIST_0];
00278 short ***list1_mv = motion->mv[LIST_1];
00279 char **list0_refIdxArr = motion->ref_idx[LIST_0];
00280 char **list1_refIdxArr = motion->ref_idx[LIST_1];
00281 short mb_x, mb_y;
00282
00283 p_Img->get_mb_block_pos (MbQ->mbAddrX, &mb_x, &mb_y);
00284 mb_x <<= 2;
00285 mb_y <<= 2;
00286
00287 yQ += dir;
00288 xQ += (1 - dir);
00289
00290 for( idx = 0 ; idx < MB_BLOCK_SIZE ; idx += BLOCK_SIZE )
00291 {
00292 if (dir)
00293 {
00294 xQ = idx;
00295 pixP.x = pixMB.x + idx;
00296 pixP.pos_x = pixMB.pos_x + idx;
00297 }
00298 else
00299 {
00300 yQ = idx;
00301 pixP.y = pixMB.y + idx;
00302 pixP.pos_y = pixMB.pos_y + idx;
00303 }
00304
00305 blkQ = (yQ & 0xFFFC) + (xQ >> 2);
00306 blkP = (pixP.y & 0xFFFC) + (pixP.x >> 2);
00307
00308 if( ((MbQ->cbp_blk[0] & ((int64)1 << blkQ )) != 0) || ((MbP->cbp_blk[0] & ((int64)1 << blkP)) != 0) )
00309 StrValue = 2;
00310 else
00311 {
00312
00313
00314
00315 blk_y = mb_y + (blkQ >> 2);
00316 blk_x = mb_x + (blkQ & 3);
00317 blk_y2 = pixP.pos_y >> 2;
00318 blk_x2 = pixP.pos_x >> 2;
00319
00320 ref_p0 = list0_refIdxArr[blk_y ][blk_x ] < 0 ? INT64_MIN : list0_refPicIdArr[blk_y ][blk_x ];
00321 ref_q0 = list0_refIdxArr[blk_y2][blk_x2] < 0 ? INT64_MIN : list0_refPicIdArr[blk_y2][blk_x2];
00322 ref_p1 = list1_refIdxArr[blk_y ][blk_x ] < 0 ? INT64_MIN : list1_refPicIdArr[blk_y ][blk_x ];
00323 ref_q1 = list1_refIdxArr[blk_y2][blk_x2] < 0 ? INT64_MIN : list1_refPicIdArr[blk_y2][blk_x2];
00324 if ( ((ref_p0==ref_q0) && (ref_p1==ref_q1)) || ((ref_p0==ref_q1) && (ref_p1==ref_q0)))
00325 {
00326
00327 if (ref_p0 != ref_p1)
00328 {
00329
00330 if (ref_p0 == ref_q0)
00331 {
00332 if (ref_p0 == INT64_MIN)
00333 {
00334 StrValue = (byte) (
00335 (iabs( list1_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00336 (iabs( list1_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit));
00337 }
00338 else if (ref_p1 == INT64_MIN)
00339 {
00340 StrValue = (byte) (
00341 (iabs( list0_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00342 (iabs( list0_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit));
00343 }
00344 else
00345 {
00346 StrValue = (byte) (
00347 (iabs( list0_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00348 (iabs( list0_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit) |
00349 (iabs( list1_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00350 (iabs( list1_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit));
00351 }
00352 }
00353 else
00354 {
00355 StrValue = (byte) (
00356 (iabs( list0_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00357 (iabs( list0_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit) |
00358 (iabs( list1_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00359 (iabs( list1_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit));
00360 }
00361 }
00362 else
00363 {
00364 StrValue = (byte) (
00365 ((iabs( list0_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00366 (iabs( list0_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit ) |
00367 (iabs( list1_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00368 (iabs( list1_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit))
00369 &&
00370 ((iabs( list0_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00371 (iabs( list0_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit) |
00372 (iabs( list1_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00373 (iabs( list1_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit)));
00374 }
00375 }
00376 else
00377 {
00378 StrValue = 1;
00379 }
00380 }
00381 memset(&Strength[idx], (byte) StrValue, BLOCK_SIZE * sizeof(byte));
00382 }
00383 }
00384 else
00385 {
00386
00387 StrValue = (edge == 0 && ((((p->structure==FRAME))) || ((p->structure != FRAME) && !dir))) ? 4 : 3;
00388 memset(&Strength[0], (byte) StrValue, MB_BLOCK_SIZE * sizeof(byte));
00389 }
00390 }
00391 }
00392
00399 void GetStrengthMBAff(byte Strength[MB_BLOCK_SIZE], Macroblock *MbQ, int dir, int edge, int mvlimit, StorablePicture *p)
00400 {
00401 short blkP, blkQ, idx;
00402 short blk_x, blk_x2, blk_y, blk_y2 ;
00403 int64 ref_p0,ref_p1,ref_q0,ref_q1;
00404 int xQ, yQ;
00405 short mb_x, mb_y;
00406 int64 **list0_refPicIdArr, **list1_refPicIdArr;
00407 short ***list0_mv, ***list1_mv;
00408 char **list0_refIdxArr, **list1_refIdxArr;
00409 Macroblock *MbP;
00410
00411 PixelPos pixP;
00412 int dir_m1 = (1 - dir);
00413
00414 PicMotionParams *motion = &p->motion;
00415 list0_mv = motion->mv[LIST_0];
00416 list1_mv = motion->mv[LIST_1];
00417 list0_refIdxArr = motion->ref_idx[LIST_0];
00418 list1_refIdxArr = motion->ref_idx[LIST_1];
00419 list0_refPicIdArr = motion->ref_pic_id[LIST_0];
00420 list1_refPicIdArr = motion->ref_pic_id[LIST_1];
00421
00422 for( idx = 0; idx < 16; ++idx )
00423 {
00424 ImageParameters *p_Img = MbQ->p_Img;
00425 xQ = dir ? idx : edge;
00426 yQ = dir ? (edge < MB_BLOCK_SIZE ? edge : 1) : idx;
00427 p_Img->getNeighbour(MbQ, xQ - dir_m1, yQ - dir, p_Img->mb_size[IS_LUMA], &pixP);
00428 blkQ = (yQ & 0xFFFC) + (xQ >> 2);
00429 blkP = (pixP.y & 0xFFFC) + (pixP.x >> 2);
00430
00431 MbP = &(p_Img->mb_data[pixP.mb_addr]);
00432 p_Img->mixedModeEdgeFlag = (byte) (MbQ->mb_field != MbP->mb_field);
00433
00434 if ((p->slice_type==SP_SLICE)||(p->slice_type==SI_SLICE) )
00435 {
00436 Strength[idx] = (edge == 0 && (((!p->MbaffFrameFlag && (p->structure==FRAME)) ||
00437 (p->MbaffFrameFlag && !MbP->mb_field && !MbQ->mb_field)) ||
00438 ((p->MbaffFrameFlag || (p->structure != FRAME)) && !dir))) ? 4 : 3;
00439 }
00440 else
00441 {
00442
00443 Strength[idx] = (edge == 0 && (((!p->MbaffFrameFlag && (p->structure==FRAME)) ||
00444 (p->MbaffFrameFlag && !MbP->mb_field && !MbQ->mb_field)) ||
00445 ((p->MbaffFrameFlag || (p->structure!=FRAME)) && !dir))) ? 4 : 3;
00446
00447 if( !(MbP->mb_type==I4MB || MbP->mb_type==I16MB || MbP->mb_type==I8MB || MbP->mb_type==IPCM)
00448 && !(MbQ->mb_type==I4MB || MbQ->mb_type==I16MB || MbQ->mb_type==I8MB || MbQ->mb_type==IPCM) )
00449 {
00450 if( ((MbQ->cbp_blk[0] & ((int64)1 << blkQ )) != 0) || ((MbP->cbp_blk[0] & ((int64)1 << blkP)) != 0) )
00451 Strength[idx] = 2 ;
00452 else
00453 {
00454
00455
00456
00457 if (p_Img->mixedModeEdgeFlag)
00458 {
00459 (Strength[idx] = 1);
00460 }
00461 else
00462 {
00463 p_Img->get_mb_block_pos (MbQ->mbAddrX, &mb_x, &mb_y);
00464 blk_y = (mb_y<<2) + (blkQ >> 2) ;
00465 blk_x = (mb_x<<2) + (blkQ & 3) ;
00466 blk_y2 = pixP.pos_y >> 2;
00467 blk_x2 = pixP.pos_x >> 2;
00468 {
00469 ref_p0 = list0_refIdxArr[blk_y ][blk_x ] < 0 ? INT64_MIN : list0_refPicIdArr[blk_y ][blk_x];
00470 ref_q0 = list0_refIdxArr[blk_y2][blk_x2] < 0 ? INT64_MIN : list0_refPicIdArr[blk_y2][blk_x2];
00471 ref_p1 = list1_refIdxArr[blk_y ][blk_x ] < 0 ? INT64_MIN : list1_refPicIdArr[blk_y ][blk_x];
00472 ref_q1 = list1_refIdxArr[blk_y2][blk_x2]<0 ? INT64_MIN : list1_refPicIdArr[blk_y2][blk_x2];
00473 if ( ((ref_p0==ref_q0) && (ref_p1==ref_q1)) ||
00474 ((ref_p0==ref_q1) && (ref_p1==ref_q0)))
00475 {
00476 Strength[idx]=0;
00477
00478 if (ref_p0 != ref_p1)
00479 {
00480
00481 if (ref_p0==ref_q0)
00482 {
00483 Strength[idx] = (byte) (
00484 (iabs( list0_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00485 (iabs( list0_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit) |
00486 (iabs( list1_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00487 (iabs( list1_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit));
00488 }
00489 else
00490 {
00491 Strength[idx] = (byte) (
00492 (iabs( list0_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00493 (iabs( list0_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit) |
00494 (iabs( list1_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00495 (iabs( list1_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit));
00496 }
00497 }
00498 else
00499 {
00500
00501 Strength[idx] = (byte) (
00502 ((iabs( list0_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00503 (iabs( list0_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit ) |
00504 (iabs( list1_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00505 (iabs( list1_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit))
00506 &&
00507 ((iabs( list0_mv[blk_y][blk_x][0] - list1_mv[blk_y2][blk_x2][0]) >= 4) |
00508 (iabs( list0_mv[blk_y][blk_x][1] - list1_mv[blk_y2][blk_x2][1]) >= mvlimit) |
00509 (iabs( list1_mv[blk_y][blk_x][0] - list0_mv[blk_y2][blk_x2][0]) >= 4) |
00510 (iabs( list1_mv[blk_y][blk_x][1] - list0_mv[blk_y2][blk_x2][1]) >= mvlimit)));
00511 }
00512 }
00513 else
00514 {
00515 Strength[idx] = 1;
00516 }
00517 }
00518 }
00519 }
00520 }
00521 }
00522 }
00523 }
00524
00531 void EdgeLoopLumaNormal(ColorPlane pl, imgpel** Img, byte Strength[16], Macroblock *MbQ,
00532 int dir, int edge, StorablePicture *p)
00533 {
00534 imgpel L2, L1, L0, R0, R1, R2, L3, R3;
00535 PixelPos pixP, pixQ, pixMB1, pixMB2;
00536 int C0, tc0, dif, RL0;
00537 int pel, ap, aq, Strng;
00538 int Alpha, Beta, small_gap;
00539 int indexA, indexB;
00540 int QP;
00541 const byte* ClipTab;
00542 int inc_dim, inc_dim3;
00543 int xQ = dir ? 0 : edge - 1;
00544 int yQ = dir ? (edge < MB_BLOCK_SIZE ? edge - 1: 0) : 0;
00545
00546 Macroblock *MbP;
00547 imgpel *SrcPtrP, *SrcPtrQ;
00548
00549 ImageParameters *p_Img = MbQ->p_Img;
00550
00551 p_Img->getNeighbour(MbQ, xQ, yQ, p_Img->mb_size[IS_LUMA], &pixMB1);
00552
00553 if (pixMB1.available || (MbQ->DFDisableIdc== 0))
00554 {
00555 int AlphaC0Offset = MbQ->DFAlphaC0Offset;
00556 int BetaOffset = MbQ->DFBetaOffset;
00557 int dirM1 = (dir - 1);
00558 int bitdepth_scale = pl ? p_Img->bitdepth_scale[IS_CHROMA] : p_Img->bitdepth_scale[IS_LUMA];
00559 int max_imgpel_value = p_Img->max_imgpel_value_comp[pl];
00560 int width = p->size_x;
00561 pixP = pixMB1;
00562 MbP = &(p_Img->mb_data[pixP.mb_addr]);
00563 inc_dim = dir ? width : 1;
00564 inc_dim3 = inc_dim * 3;
00565
00566 yQ += dir;
00567 xQ -= dirM1;
00568 p_Img->getNeighbour(MbQ, xQ, yQ, p_Img->mb_size[IS_LUMA], &pixMB2);
00569 pixQ = pixMB2;
00570
00571
00572 QP = pl? ((MbP->qpc[pl-1] + MbQ->qpc[pl-1] + 1) >> 1) : (MbP->qp + MbQ->qp + 1) >> 1;
00573
00574 indexA = iClip3(0, MAX_QP, QP + AlphaC0Offset);
00575 indexB = iClip3(0, MAX_QP, QP + BetaOffset);
00576
00577 Alpha = ALPHA_TABLE[indexA] * bitdepth_scale;
00578 Beta = BETA_TABLE [indexB] * bitdepth_scale;
00579 ClipTab = CLIP_TAB[indexA];
00580
00581 for( pel = 0 ; pel < MB_BLOCK_SIZE ; ++pel )
00582 {
00583 if( (Strng = *(Strength++)) != 0)
00584 {
00585 SrcPtrQ = &(Img[pixQ.pos_y][pixQ.pos_x]);
00586 SrcPtrP = &(Img[pixP.pos_y][pixP.pos_x]);
00587
00588 L3 = *(SrcPtrP -= inc_dim3);
00589 L2 = *(SrcPtrP += inc_dim);
00590 L1 = *(SrcPtrP += inc_dim);
00591 L0 = *(SrcPtrP += inc_dim);
00592 R0 = *SrcPtrQ;
00593 R1 = *(SrcPtrQ += inc_dim);
00594 R2 = *(SrcPtrQ += inc_dim);
00595 R3 = *(SrcPtrQ += inc_dim);
00596
00597 if( iabs( R0 - L0 ) < Alpha )
00598 {
00599 if ((iabs( R0 - R1) < Beta) && (iabs(L0 - L1) < Beta))
00600 {
00601 if(Strng == 4 )
00602 {
00603 RL0 = L0 + R0;
00604 small_gap = (iabs( R0 - L0 ) < ((Alpha >> 2) + 2));
00605 aq = ( iabs( R0 - R2) < Beta ) & small_gap;
00606 ap = ( iabs( L0 - L2) < Beta ) & small_gap;
00607
00608 if (ap)
00609 {
00610 *SrcPtrP = (imgpel) (( R1 + ((L1 + RL0) << 1) + L2 + 4) >> 3);
00611 *(SrcPtrP -= inc_dim) = (imgpel) (( L2 + L1 + RL0 + 2) >> 2);
00612 *(SrcPtrP - inc_dim) = (imgpel) ((((L3 + L2) <<1) + L2 + L1 + RL0 + 4) >> 3);
00613 }
00614 else
00615 {
00616 *SrcPtrP = (imgpel) (((L1 << 1) + L0 + R1 + 2) >> 2) ;
00617 }
00618
00619 if (aq)
00620 {
00621 *(SrcPtrQ -= inc_dim3) = (imgpel) (( L1 + ((R1 + RL0) << 1) + R2 + 4) >> 3);
00622 *(SrcPtrQ += inc_dim ) = (imgpel) (( R2 + R0 + L0 + R1 + 2) >> 2);
00623 *(SrcPtrQ + inc_dim ) = (imgpel) ((((R3 + R2) <<1) + R2 + R1 + RL0 + 4) >> 3);
00624 }
00625 else
00626 {
00627 *(SrcPtrQ - inc_dim3) = (imgpel) (((R1 << 1) + R0 + L1 + 2) >> 2);
00628 }
00629 }
00630 else
00631 {
00632 RL0 = (L0 + R0 + 1) >> 1;
00633 aq = (iabs(R0 - R2) < Beta);
00634 ap = (iabs(L0 - L2) < Beta);
00635
00636 C0 = ClipTab[ Strng ] * bitdepth_scale;
00637 tc0 = (C0 + ap + aq) ;
00638 dif = iClip3( -tc0, tc0, (((R0 - L0) << 2) + (L1 - R1) + 4) >> 3 );
00639
00640 if( ap )
00641 *(SrcPtrP - inc_dim) += iClip3( -C0, C0, (L2 + RL0 - (L1<<1)) >> 1 );
00642
00643 *SrcPtrP = (imgpel) iClip1(max_imgpel_value, L0 + dif);
00644 *(SrcPtrQ -= inc_dim3) = (imgpel) iClip1(max_imgpel_value, R0 - dif);
00645
00646 if( aq )
00647 *(SrcPtrQ + inc_dim) += iClip3( -C0, C0, (R2 + RL0 - (R1<<1)) >> 1 );
00648 }
00649 }
00650 }
00651 }
00652 pixP.pos_x += dir;
00653 pixQ.pos_x += dir;
00654 pixP.pos_y -= dirM1;
00655 pixQ.pos_y -= dirM1;
00656 }
00657 }
00658 }
00659
00666 void EdgeLoopLumaMBAff(ColorPlane pl, imgpel** Img, byte Strength[16], Macroblock *MbQ,
00667 int dir, int edge, StorablePicture *p)
00668 {
00669 int width = p->size_x;
00670 int pel, ap = 0, aq = 0, Strng ;
00671 int incP, incQ;
00672 int C0, tc0, dif;
00673 imgpel L2 = 0, L1, L0, R0, R1, R2 = 0, L3, R3;
00674 int RL0;
00675 int Alpha = 0, Beta = 0 ;
00676 const byte* ClipTab = NULL;
00677 int small_gap;
00678 int indexA, indexB;
00679 int PelNum = pl? pelnum_cr[dir][p->chroma_format_idc] : MB_BLOCK_SIZE;
00680
00681 int QP;
00682 int xQ, yQ;
00683
00684 PixelPos pixP, pixQ;
00685 int dir_m1 = (1 - dir);
00686 ImageParameters *p_Img = MbQ->p_Img;
00687 int bitdepth_scale = pl? p_Img->bitdepth_scale[IS_CHROMA] : p_Img->bitdepth_scale[IS_LUMA];
00688 int max_imgpel_value = p_Img->max_imgpel_value_comp[pl];
00689
00690 int AlphaC0Offset = MbQ->DFAlphaC0Offset;
00691 int BetaOffset = MbQ->DFBetaOffset;
00692 byte fieldModeFilteringFlag;
00693
00694 Macroblock *MbP;
00695 imgpel *SrcPtrP, *SrcPtrQ;
00696
00697 for( pel = 0 ; pel < PelNum ; ++pel )
00698 {
00699 xQ = dir ? pel : edge;
00700 yQ = dir ? (edge < 16 ? edge : 1) : pel;
00701 p_Img->getNeighbour(MbQ, xQ - (dir_m1), yQ - dir, p_Img->mb_size[IS_LUMA], &pixP);
00702
00703 if (pixP.available || (MbQ->DFDisableIdc== 0))
00704 {
00705 if( (Strng = Strength[pel]) != 0)
00706 {
00707 p_Img->getNeighbour(MbQ, xQ, yQ, p_Img->mb_size[IS_LUMA], &pixQ);
00708
00709 MbP = &(p_Img->mb_data[pixP.mb_addr]);
00710 fieldModeFilteringFlag = (byte) (MbQ->mb_field || MbP->mb_field);
00711
00712 incQ = dir ? ((fieldModeFilteringFlag && !MbQ->mb_field) ? 2 * width : width) : 1;
00713 incP = dir ? ((fieldModeFilteringFlag && !MbP->mb_field) ? 2 * width : width) : 1;
00714 SrcPtrQ = &(Img[pixQ.pos_y][pixQ.pos_x]);
00715 SrcPtrP = &(Img[pixP.pos_y][pixP.pos_x]);
00716
00717
00718 QP = pl? ((MbP->qpc[pl-1] + MbQ->qpc[pl-1] + 1) >> 1) : (MbP->qp + MbQ->qp + 1) >> 1;
00719
00720 indexA = iClip3(0, MAX_QP, QP + AlphaC0Offset);
00721 indexB = iClip3(0, MAX_QP, QP + BetaOffset);
00722
00723 Alpha = ALPHA_TABLE[indexA] * bitdepth_scale;
00724 Beta = BETA_TABLE [indexB] * bitdepth_scale;
00725 ClipTab = CLIP_TAB[indexA];
00726
00727 L3 = SrcPtrP[-incP*3];
00728 L2 = SrcPtrP[-incP*2];
00729 L1 = SrcPtrP[-incP];
00730 L0 = SrcPtrP[0] ;
00731 R0 = SrcPtrQ[0] ;
00732 R1 = SrcPtrQ[ incQ];
00733 R2 = SrcPtrQ[ incQ*2];
00734 R3 = SrcPtrQ[ incQ*3];
00735
00736 if( iabs( R0 - L0 ) < Alpha )
00737 {
00738 if ((iabs( R0 - R1) < Beta ) && (iabs(L0 - L1) < Beta ))
00739 {
00740 if(Strng == 4 )
00741 {
00742 RL0 = L0 + R0;
00743 small_gap = (iabs( R0 - L0 ) < ((Alpha >> 2) + 2));
00744 aq = ( iabs( R0 - R2) < Beta ) & small_gap;
00745 ap = ( iabs( L0 - L2) < Beta ) & small_gap;
00746
00747 if (ap)
00748 {
00749 SrcPtrP[-incP * 2] = (imgpel) ((((L3 + L2) << 1) + L2 + L1 + RL0 + 4) >> 3);
00750 SrcPtrP[-incP ] = (imgpel) (( L2 + L1 + L0 + R0 + 2) >> 2);
00751 SrcPtrP[ 0 ] = (imgpel) (( R1 + ((L1 + RL0) << 1) + L2 + 4) >> 3);
00752 }
00753 else
00754 {
00755 SrcPtrP[ 0 ] = (imgpel) (((L1 << 1) + L0 + R1 + 2) >> 2) ;
00756 }
00757
00758 if (aq)
00759 {
00760 SrcPtrQ[ 0 ] = (imgpel) (( L1 + ((R1 + RL0) << 1) + R2 + 4) >> 3);
00761 SrcPtrQ[ incQ ] = (imgpel) (( R2 + R0 + R1 + L0 + 2) >> 2);
00762 SrcPtrQ[ incQ * 2 ] = (imgpel) ((((R3 + R2) << 1) + R2 + R1 + RL0 + 4) >> 3);
00763 }
00764 else
00765 {
00766 SrcPtrQ[ 0 ] = (imgpel) (((R1 << 1) + R0 + L1 + 2) >> 2);
00767 }
00768 }
00769 else
00770 {
00771 RL0 = (L0 + R0 + 1) >> 1;
00772 aq = (iabs( R0 - R2) < Beta);
00773 ap = (iabs( L0 - L2) < Beta);
00774
00775 C0 = ClipTab[ Strng ] * bitdepth_scale;
00776 tc0 = (C0 + ap + aq) ;
00777 dif = iClip3( -tc0, tc0, (((R0 - L0) << 2) + (L1 - R1) + 4) >> 3) ;
00778
00779 if( ap )
00780 *(SrcPtrP - incP) += iClip3( -C0, C0, ( L2 + RL0 - (L1 << 1)) >> 1 ) ;
00781
00782 *SrcPtrP = (imgpel) iClip1 (max_imgpel_value, L0 + dif) ;
00783 *SrcPtrQ = (imgpel) iClip1 (max_imgpel_value, R0 - dif) ;
00784
00785 if( aq )
00786 *(SrcPtrQ + incQ) += iClip3( -C0, C0, ( R2 + RL0 - (R1 << 1)) >> 1 ) ;
00787 }
00788 }
00789 }
00790 }
00791 }
00792 }
00793 }
00794
00801 void EdgeLoopChromaNormal(imgpel** Img, byte Strength[16], Macroblock *MbQ, int dir, int edge, int uv, StorablePicture *p)
00802 {
00803 int pel, Strng ;
00804 int inc_dim;
00805 int tc0, dif;
00806 imgpel L1, L0, R0, R1;
00807 int Alpha, Beta;
00808 const byte* ClipTab;
00809 int indexA, indexB;
00810 int StrengthIdx;
00811 PixelPos pixP, pixQ, pixMB1, pixMB2;
00812 int QP;
00813 int PelNum = pelnum_cr[dir][p->chroma_format_idc];
00814 ImageParameters *p_Img = MbQ->p_Img;
00815
00816 int bitdepth_scale = p_Img->bitdepth_scale[IS_CHROMA];
00817 int max_imgpel_value = p_Img->max_imgpel_value_comp[uv + 1];
00818
00819 int xQ = dir ? 0 : edge - 1;
00820 int yQ = dir ? (edge < 16 ? edge - 1: 0) : 0;
00821 Macroblock *MbP;
00822 imgpel *SrcPtrP, *SrcPtrQ;
00823
00824 p_Img->getNeighbour(MbQ, xQ, yQ, p_Img->mb_size[IS_CHROMA], &pixMB1);
00825
00826 if (pixMB1.available || (MbQ->DFDisableIdc == 0))
00827 {
00828 int AlphaC0Offset = MbQ->DFAlphaC0Offset;
00829 int BetaOffset = MbQ->DFBetaOffset;
00830 int width = p->size_x_cr;
00831 int dirM1 = dir - 1;
00832 pixP = pixMB1;
00833 MbP = &(p_Img->mb_data[pixP.mb_addr]);
00834 yQ += dir;
00835 xQ -= dirM1;
00836 inc_dim = dir ? width : 1;
00837
00838 p_Img->getNeighbour(MbQ, xQ, yQ, p_Img->mb_size[IS_CHROMA], &pixMB2);
00839 pixQ = pixMB2;
00840
00841
00842 QP = (MbP->qpc[uv] + MbQ->qpc[uv] + 1) >> 1;
00843
00844 indexA = iClip3(0, MAX_QP, QP + AlphaC0Offset);
00845 indexB = iClip3(0, MAX_QP, QP + BetaOffset);
00846
00847 Alpha = ALPHA_TABLE[indexA] * bitdepth_scale;
00848 Beta = BETA_TABLE [indexB] * bitdepth_scale;
00849 ClipTab = CLIP_TAB[indexA];
00850
00851 for( pel = 0 ; pel < PelNum ; ++pel )
00852 {
00853 StrengthIdx = (PelNum == 8) ? (((pel >> 1) << 2) + (pel & 0x01)) : pel;
00854
00855 if( (Strng = Strength[StrengthIdx]) != 0)
00856 {
00857 SrcPtrP = &(Img[pixP.pos_y][pixP.pos_x]);
00858 L1 = *(SrcPtrP - inc_dim);
00859 L0 = *SrcPtrP;
00860 SrcPtrQ = &(Img[pixQ.pos_y][pixQ.pos_x]);
00861 R0 = *SrcPtrQ;
00862 R1 = *(SrcPtrQ + inc_dim);
00863
00864 if (( iabs( R0 - L0 ) < Alpha ) && ( iabs(R0 - R1) < Beta ) && ( iabs(L0 - L1) < Beta ) )
00865 {
00866 if( Strng == 4 )
00867 {
00868 *SrcPtrP = (imgpel) ( ((L1 << 1) + L0 + R1 + 2) >> 2 );
00869 *SrcPtrQ = (imgpel) ( ((R1 << 1) + R0 + L1 + 2) >> 2 );
00870 }
00871 else
00872 {
00873 tc0 = ClipTab[ Strng ] * bitdepth_scale + 1;
00874 dif = iClip3( -tc0, tc0, ( ((R0 - L0) << 2) + (L1 - R1) + 4) >> 3 );
00875
00876 *SrcPtrP = (imgpel) iClip1 ( max_imgpel_value, L0 + dif) ;
00877 *SrcPtrQ = (imgpel) iClip1 ( max_imgpel_value, R0 - dif) ;
00878 }
00879 }
00880 }
00881 pixP.pos_x += dir;
00882 pixQ.pos_x += dir;
00883 pixP.pos_y -= dirM1;
00884 pixQ.pos_y -= dirM1;
00885 }
00886 }
00887 }
00888
00895 void EdgeLoopChromaMBAff(imgpel** Img, byte Strength[16], Macroblock *MbQ, int dir, int edge, int uv, StorablePicture *p)
00896 {
00897 int pel, Strng ;
00898 int incP, incQ;
00899 int C0, tc0, dif;
00900 imgpel L1, L0, R0, R1;
00901 int Alpha = 0, Beta = 0;
00902 const byte* ClipTab = NULL;
00903 int indexA, indexB;
00904 int PelNum = pelnum_cr[dir][p->chroma_format_idc];
00905 int StrengthIdx;
00906 int QP;
00907 int xQ, yQ;
00908 PixelPos pixP, pixQ;
00909 int dir_m1 = 1 - dir;
00910 ImageParameters *p_Img = MbQ->p_Img;
00911 int bitdepth_scale = p_Img->bitdepth_scale[IS_CHROMA];
00912 int max_imgpel_value = p_Img->max_imgpel_value_comp[uv + 1];
00913
00914 int AlphaC0Offset = MbQ->DFAlphaC0Offset;
00915 int BetaOffset = MbQ->DFBetaOffset;
00916 byte fieldModeFilteringFlag;
00917 Macroblock *MbP;
00918 imgpel *SrcPtrP, *SrcPtrQ;
00919 int width = p->size_x_cr;
00920
00921 for( pel = 0 ; pel < PelNum ; ++pel )
00922 {
00923 xQ = dir ? pel : edge;
00924 yQ = dir ? (edge < 16? edge : 1) : pel;
00925 p_Img->getNeighbour(MbQ, xQ, yQ, p_Img->mb_size[IS_CHROMA], &pixQ);
00926 p_Img->getNeighbour(MbQ, xQ - (dir_m1), yQ - dir, p_Img->mb_size[IS_CHROMA], &pixP);
00927 MbP = &(p_Img->mb_data[pixP.mb_addr]);
00928 StrengthIdx = (PelNum == 8) ? ((MbQ->mb_field && !MbP->mb_field) ? pel << 1 :((pel >> 1) << 2) + (pel & 0x01)) : pel;
00929
00930 if (pixP.available || (MbQ->DFDisableIdc == 0))
00931 {
00932 if( (Strng = Strength[StrengthIdx]) != 0)
00933 {
00934 fieldModeFilteringFlag = (byte) (MbQ->mb_field || MbP->mb_field);
00935 incQ = dir ? ((fieldModeFilteringFlag && !MbQ->mb_field) ? 2 * width : width) : 1;
00936 incP = dir ? ((fieldModeFilteringFlag && !MbP->mb_field) ? 2 * width : width) : 1;
00937 SrcPtrQ = &(Img[pixQ.pos_y][pixQ.pos_x]);
00938 SrcPtrP = &(Img[pixP.pos_y][pixP.pos_x]);
00939
00940
00941 QP = (MbP->qpc[uv] + MbQ->qpc[uv] + 1) >> 1;
00942
00943 indexA = iClip3(0, MAX_QP, QP + AlphaC0Offset);
00944 indexB = iClip3(0, MAX_QP, QP + BetaOffset);
00945
00946 Alpha = ALPHA_TABLE[indexA] * bitdepth_scale;
00947 Beta = BETA_TABLE [indexB] * bitdepth_scale;
00948 ClipTab = CLIP_TAB[indexA];
00949
00950 L1 = SrcPtrP[-incP];
00951 L0 = SrcPtrP[0] ;
00952 R0 = SrcPtrQ[0] ;
00953 R1 = SrcPtrQ[ incQ];
00954
00955 if( iabs( R0 - L0 ) < Alpha )
00956 {
00957 if( ((iabs( R0 - R1) - Beta ) & (iabs(L0 - L1) - Beta )) < 0 )
00958 {
00959 if( Strng == 4 )
00960 {
00961 SrcPtrQ[0] = (imgpel) ( ((R1 << 1) + R0 + L1 + 2) >> 2 );
00962 SrcPtrP[0] = (imgpel) ( ((L1 << 1) + L0 + R1 + 2) >> 2 );
00963 }
00964 else
00965 {
00966 C0 = ClipTab[ Strng ] * bitdepth_scale;
00967 tc0 = (C0 + 1);
00968 dif = iClip3( -tc0, tc0, ( ((R0 - L0) << 2) + (L1 - R1) + 4) >> 3 );
00969
00970 SrcPtrP[0] = (imgpel) iClip1 ( max_imgpel_value, L0 + dif );
00971 SrcPtrQ[0] = (imgpel) iClip1 ( max_imgpel_value, R0 - dif );
00972 }
00973 }
00974 }
00975 }
00976 }
00977 }
00978 }
00979