[svn] / trunk / xvidcore / src / motion / estimation_bvop.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/motion/estimation_bvop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1567, Wed Dec 8 12:43:48 2004 UTC revision 1919, Fri Dec 24 13:21:35 2010 UTC
# Line 4  Line 4 
4   *  - Motion Estimation for B-VOPs  -   *  - Motion Estimation for B-VOPs  -
5   *   *
6   *  Copyright(C) 2002 Christoph Lampert <gruel@web.de>   *  Copyright(C) 2002 Christoph Lampert <gruel@web.de>
7   *               2002 Michael Militzer <michael@xvid.org>   *               2002-2010 Michael Militzer <michael@xvid.org>
8   *               2002-2003 Radoslaw Czyz <xvid@syskin.cjb.net>   *               2002-2003 Radoslaw Czyz <xvid@syskin.cjb.net>
9   *   *
10   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
# Line 21  Line 21 
21   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: estimation_bvop.c,v 1.18 2004-12-08 12:43:48 syskin Exp $   * $Id: estimation_bvop.c,v 1.28 2010-12-24 13:21:35 Isibaar Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 141  Line 141 
141                   + d_mv_bits(xb, yb, data->bpredMV, data->iFcode, data->qpel^data->qpel_precision);                   + d_mv_bits(xb, yb, data->bpredMV, data->iFcode, data->qpel^data->qpel_precision);
142    
143          sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth);          sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth);
144          sad += (data->lambda16 * t * sad)>>10;          sad += (data->lambda16 * t);
145    
146          if (data->chroma && sad < *data->iMinSAD)          if (data->chroma && sad < *data->iMinSAD)
147                  sad += ChromaSAD2((xcf >> 1) + roundtab_79[xcf & 0x3],                  sad += ChromaSAD2((xcf >> 1) + roundtab_79[xcf & 0x3],
# Line 207  Line 207 
207                  if (sad > *(data->iMinSAD)) return;                  if (sad > *(data->iMinSAD)) return;
208          }          }
209    
210          sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0) * sad)>>10;          sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0));
211    
212          if (data->chroma && sad < *data->iMinSAD)          if (data->chroma && sad < *data->iMinSAD)
213                  sad += ChromaSAD2((xcf >> 3) + roundtab_76[xcf & 0xf],                  sad += ChromaSAD2((xcf >> 3) + roundtab_76[xcf & 0xf],
# Line 265  Line 265 
265    
266  done:  done:
267          sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth);          sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth);
268          sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0) * sad)>>10;          sad += (data->lambda16 * d_mv_bits(x, y, zeroMV, 1, 0));
269    
270          if (data->chroma && sad < *data->iMinSAD)          if (data->chroma && sad < *data->iMinSAD)
271                  sad += ChromaSAD2((xcf >> 3) + roundtab_76[xcf & 0xf],                  sad += ChromaSAD2((xcf >> 3) + roundtab_76[xcf & 0xf],
# Line 304  Line 304 
304                                          data->qpel^data->qpel_precision);                                          data->qpel^data->qpel_precision);
305    
306          sad = sad16(data->Cur, Reference, data->iEdgedWidth, 256*4096);          sad = sad16(data->Cur, Reference, data->iEdgedWidth, 256*4096);
307          sad += (data->lambda16 * t * sad)>>10;          sad += (data->lambda16 * t);
308    
309          if (data->chroma && sad < *data->iMinSAD)          if (data->chroma && sad < *data->iMinSAD)
310                  sad += xvid_me_ChromaSAD((xc >> 1) + roundtab_79[xc & 0x3],                  sad += xvid_me_ChromaSAD((xc >> 1) + roundtab_79[xc & 0x3],
# Line 800  Line 800 
800                                            MACROBLOCK * const pMB,                                            MACROBLOCK * const pMB,
801                                            const MACROBLOCK * const b_mb,                                            const MACROBLOCK * const b_mb,
802                                            VECTOR * f_predMV,                                            VECTOR * f_predMV,
803                                            VECTOR * b_predMV)                                            VECTOR * b_predMV,
804                                              int force_direct)
805  {  {
806          int mode = MODE_DIRECT, k;          int mode = MODE_DIRECT, k;
807          int best_sad, f_sad, b_sad, i_sad;          int best_sad, f_sad, b_sad, i_sad;
# Line 812  Line 813 
813          f_sad = Data_f->iMinSAD[0] + 4*Data_d->lambda16;          f_sad = Data_f->iMinSAD[0] + 4*Data_d->lambda16;
814          i_sad = Data_i->iMinSAD[0] + 2*Data_d->lambda16;          i_sad = Data_i->iMinSAD[0] + 2*Data_d->lambda16;
815    
816            if (force_direct)
817                    goto set_mode; /* bypass checks for non-direct modes */
818    
819          if (b_sad < best_sad) {          if (b_sad < best_sad) {
820                  mode = MODE_BACKWARD;                  mode = MODE_BACKWARD;
821                  best_sad = b_sad;                  best_sad = b_sad;
# Line 827  Line 831 
831                  best_sad = i_sad;                  best_sad = i_sad;
832          }          }
833    
834    set_mode:
835          pMB->sad16 = best_sad;          pMB->sad16 = best_sad;
836          pMB->mode = mode;          pMB->mode = mode;
837            pMB->cbp = 63;
838    
839          switch (mode) {          switch (mode) {
840    
# Line 960  Line 966 
966                                           const IMAGE * const b_ref,                                           const IMAGE * const b_ref,
967                                           const IMAGE * const b_refH,                                           const IMAGE * const b_refH,
968                                           const IMAGE * const b_refV,                                           const IMAGE * const b_refV,
969                                           const IMAGE * const b_refHV)                                           const IMAGE * const b_refHV,
970                                             const int num_slices)
971  {  {
972          uint32_t i, j;          uint32_t i, j;
973          int32_t best_sad = 256*4096;          int32_t best_sad = 256*4096;
         int32_t sad2;  
974          uint32_t skip_sad;          uint32_t skip_sad;
975            int fb_thresh;
976          const MACROBLOCK * const b_mbs = b_reference->mbs;          const MACROBLOCK * const b_mbs = b_reference->mbs;
977    
978          VECTOR f_predMV, b_predMV;          VECTOR f_predMV, b_predMV;
979    
980            int mb_width = pParam->mb_width;
981            int mb_height = pParam->mb_height;
982          int MVmaxF = 0, MVmaxB = 0;          int MVmaxF = 0, MVmaxB = 0;
983          const int32_t TRB = time_pp - time_bp;          const int32_t TRB = time_pp - time_bp;
984          const int32_t TRD = time_pp;          const int32_t TRD = time_pp;
# Line 985  Line 993 
993          Data_d.rounding = 0;          Data_d.rounding = 0;
994          Data_d.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;          Data_d.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;
995          Data_d.iQuant = frame->quant;          Data_d.iQuant = frame->quant;
996            Data_d.quant_sq = frame->quant*frame->quant;
997          Data_d.dctSpace = dct_space;          Data_d.dctSpace = dct_space;
998          Data_d.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT);          Data_d.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT);
999          Data_d.mpeg_quant_matrices = pParam->mpeg_quant_matrices;          Data_d.mpeg_quant_matrices = pParam->mpeg_quant_matrices;
# Line 999  Line 1008 
1008          Data_b.iFcode = Data_i.bFcode = frame->bcode = b_reference->fcode;          Data_b.iFcode = Data_i.bFcode = frame->bcode = b_reference->fcode;
1009    
1010          for (j = 0; j < pParam->mb_height; j++) {          for (j = 0; j < pParam->mb_height; j++) {
1011                    int new_bound = mb_width * ((((j*num_slices) / mb_height) * mb_height + (num_slices-1)) / num_slices);
1012    
1013                  f_predMV = b_predMV = zeroMV;   /* prediction is reset at left boundary */                  f_predMV = b_predMV = zeroMV;   /* prediction is reset at left boundary */
1014    
1015                  for (i = 0; i < pParam->mb_width; i++) {                  for (i = 0; i < pParam->mb_width; i++) {
1016                          MACROBLOCK * const pMB = frame->mbs + i + j * pParam->mb_width;                          MACROBLOCK * const pMB = frame->mbs + i + j * pParam->mb_width;
1017                          const MACROBLOCK * const b_mb = b_mbs + i + j * pParam->mb_width;                          const MACROBLOCK * const b_mb = b_mbs + i + j * pParam->mb_width;
1018                            int force_direct = (((j*mb_width+i)==new_bound) && (j > 0)) ? 1 : 0; /* MTK decoder chipsets do NOT reset predMVs upon resync marker in BVOPs. We workaround this problem
1019                                                                                                                                                                        by placing the slice border on second MB in a row and then force the first MB to be direct mode */
1020    
1021                          pMB->mode = -1;                          pMB->mode = -1;
1022    
1023                          initialize_searchData(&Data_d, &Data_f, &Data_b, &Data_i,                          initialize_searchData(&Data_d, &Data_f, &Data_b, &Data_i,
# Line 1028  Line 1041 
1041    
1042                          if (pMB->mode == MODE_DIRECT_NONE_MV) {                          if (pMB->mode == MODE_DIRECT_NONE_MV) {
1043                                  pMB->sad16 = best_sad;                                  pMB->sad16 = best_sad;
1044                                    pMB->cbp = 0;
1045                                  continue;                                  continue;
1046                          }                          }
1047    
# Line 1037  Line 1051 
1051                          SearchBF_initial(i, j, frame->motion_flags, frame->bcode, pParam, pMB,                          SearchBF_initial(i, j, frame->motion_flags, frame->bcode, pParam, pMB,
1052                                                  &b_predMV, &best_sad, MODE_BACKWARD, &Data_b, Data_d.currentMV[2]);                                                  &b_predMV, &best_sad, MODE_BACKWARD, &Data_b, Data_d.currentMV[2]);
1053    
1054                          sad2 = best_sad;                          if (frame->motion_flags&XVID_ME_BFRAME_EARLYSTOP)
1055                                    fb_thresh = best_sad;
1056                            else
1057                                    fb_thresh = best_sad + (best_sad>>1);
1058    
1059                          if (Data_f.iMinSAD[0] < 2*sad2+2000)                          if (Data_f.iMinSAD[0] <= fb_thresh)
1060                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_f);                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_f);
1061    
1062                          if (Data_b.iMinSAD[0] < 2*sad2+2000)                          if (Data_b.iMinSAD[0] <= fb_thresh)
1063                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_b);                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_b);
1064    
1065                          SearchInterpolate_initial(i, j, frame->motion_flags, pParam, &f_predMV, &b_predMV, &best_sad,                          SearchInterpolate_initial(i, j, frame->motion_flags, pParam, &f_predMV, &b_predMV, &best_sad,
1066                                                                    &Data_i, Data_f.currentMV[0], Data_b.currentMV[0]);                                                                    &Data_i, Data_f.currentMV[0], Data_b.currentMV[0]);
1067    
1068                          if (((Data_i.iMinSAD[0] < 2*best_sad+2000) && !(frame->motion_flags&XVID_ME_FAST_MODEINTERPOLATE))                          if (((Data_i.iMinSAD[0] < best_sad +(best_sad>>3)) && !(frame->motion_flags&XVID_ME_FAST_MODEINTERPOLATE))
1069                                  || Data_i.iMinSAD[0] <= best_sad)                                  || Data_i.iMinSAD[0] <= best_sad)
1070    
1071                                  SearchInterpolate_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_i);                                  SearchInterpolate_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_i);
1072    
1073                          if ((Data_d.iMinSAD[0] <= 2*best_sad) && (!frame->motion_flags&XVID_ME_SKIP_DELTASEARCH))                          if (Data_d.iMinSAD[0] <= 2*best_sad)
1074                                    if ((!(frame->motion_flags&XVID_ME_SKIP_DELTASEARCH) && (best_sad > 750))
1075                                            || (best_sad > 1000))
1076    
1077                                  SearchDirect_final(frame->motion_flags, b_mb, &best_sad, &Data_d);                                  SearchDirect_final(frame->motion_flags, b_mb, &best_sad, &Data_d);
1078    
1079                          /* final skip decision */                          /* final skip decision */
# Line 1066  Line 1086 
1086    
1087                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */
1088                                          pMB->sad16 = skip_sad;                                          pMB->sad16 = skip_sad;
1089                                            pMB->cbp = 0;
1090                                          continue;                                          continue;
1091                                  }                                  }
1092                          }                          }
1093    
1094                          if (frame->vop_flags & XVID_VOP_RD_BVOP)                          if (frame->vop_flags & XVID_VOP_RD_BVOP)
1095                                  ModeDecision_BVOP_RD(&Data_d, &Data_b, &Data_f, &Data_i,                                  ModeDecision_BVOP_RD(&Data_d, &Data_b, &Data_f, &Data_i,
1096                                          pMB, b_mb, &f_predMV, &b_predMV, frame->motion_flags, pParam, i, j);                                          pMB, b_mb, &f_predMV, &b_predMV, frame->motion_flags, frame->vop_flags, pParam, i, j, best_sad, force_direct);
1097                          else                          else
1098                                  ModeDecision_BVOP_SAD(&Data_d, &Data_b, &Data_f, &Data_i, pMB, b_mb, &f_predMV, &b_predMV);                                  ModeDecision_BVOP_SAD(&Data_d, &Data_b, &Data_f, &Data_i, pMB, b_mb, &f_predMV, &b_predMV, force_direct);
1099    
1100                          maxMotionBVOP(&MVmaxF, &MVmaxB, pMB, Data_d.qpel);                          maxMotionBVOP(&MVmaxF, &MVmaxB, pMB, Data_d.qpel);
1101    
# Line 1084  Line 1105 
1105          frame->fcode = getMinFcode(MVmaxF);          frame->fcode = getMinFcode(MVmaxF);
1106          frame->bcode = getMinFcode(MVmaxB);          frame->bcode = getMinFcode(MVmaxB);
1107  }  }
1108    
1109    
1110    
1111    void
1112    SMPMotionEstimationBVOP(SMPData * h)
1113    {
1114            Encoder *pEnc = (Encoder *) h->pEnc;
1115    
1116            const MBParam * const pParam = &pEnc->mbParam;
1117            const FRAMEINFO * const frame = h->current;
1118            const int32_t time_bp = (int32_t)(pEnc->current->stamp - frame->stamp);
1119            const int32_t time_pp = (int32_t)(pEnc->current->stamp - pEnc->reference->stamp);
1120            /* forward (past) reference */
1121            const IMAGE * const f_ref = &pEnc->reference->image;
1122            const IMAGE * const f_refH = &pEnc->f_refh;
1123            const IMAGE * const f_refV = &pEnc->f_refv;
1124            const IMAGE * const f_refHV = &pEnc->f_refhv;
1125            /* backward (future) reference */
1126            const FRAMEINFO * const b_reference = pEnc->current;
1127            const IMAGE * const b_ref = &pEnc->current->image;
1128            const IMAGE * const b_refH = &pEnc->vInterH;
1129            const IMAGE * const b_refV = &pEnc->vInterV;
1130            const IMAGE * const b_refHV = &pEnc->vInterHV;
1131    
1132            int mb_width = pParam->mb_width;
1133            int mb_height = pParam->mb_height;
1134            int num_slices = pEnc->num_slices;
1135            int y_row = h->y_row;
1136            int y_step = h->y_step;
1137            int start_y = h->start_y;
1138            int stop_y = h->stop_y;
1139            int * complete_count_self = h->complete_count_self;
1140            const int * complete_count_above = h->complete_count_above;
1141            int max_mbs;
1142            int current_mb = 0;
1143    
1144            int32_t i, j;
1145            int32_t best_sad = 256*4096;
1146            uint32_t skip_sad;
1147            int fb_thresh;
1148            const MACROBLOCK * const b_mbs = b_reference->mbs;
1149    
1150            VECTOR f_predMV, b_predMV;
1151    
1152            int MVmaxF = 0, MVmaxB = 0;
1153            const int32_t TRB = time_pp - time_bp;
1154            const int32_t TRD = time_pp;
1155            DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE);
1156    
1157            /* some pre-inintialized data for the rest of the search */
1158            SearchData Data_d, Data_f, Data_b, Data_i;
1159            memset(&Data_d, 0, sizeof(SearchData));
1160    
1161            Data_d.iEdgedWidth = pParam->edged_width;
1162            Data_d.qpel = pParam->vol_flags & XVID_VOL_QUARTERPEL ? 1 : 0;
1163            Data_d.rounding = 0;
1164            Data_d.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;
1165            Data_d.iQuant = frame->quant;
1166            Data_d.quant_sq = frame->quant*frame->quant;
1167            Data_d.dctSpace = dct_space;
1168            Data_d.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT);
1169            Data_d.mpeg_quant_matrices = pParam->mpeg_quant_matrices;
1170    
1171            Data_d.RefQ = h->RefQ;
1172    
1173            memcpy(&Data_f, &Data_d, sizeof(SearchData));
1174            memcpy(&Data_b, &Data_d, sizeof(SearchData));
1175            memcpy(&Data_i, &Data_d, sizeof(SearchData));
1176    
1177            Data_f.iFcode = Data_i.iFcode = frame->fcode;
1178            Data_b.iFcode = Data_i.bFcode = frame->bcode;
1179    
1180            max_mbs = 0;
1181    
1182            for (j = (start_y+y_row); j < stop_y; j += y_step) {
1183                    int new_bound = mb_width * ((((j*num_slices) / mb_height) * mb_height + (num_slices-1)) / num_slices);
1184    
1185                    if (j == start_y) max_mbs = pParam->mb_width; /* we can process all blocks of the first row */
1186    
1187                    f_predMV = b_predMV = zeroMV;   /* prediction is reset at left boundary */
1188    
1189                    for (i = 0; i < (int) pParam->mb_width; i++) {
1190                            MACROBLOCK * const pMB = frame->mbs + i + j * pParam->mb_width;
1191                            const MACROBLOCK * const b_mb = b_mbs + i + j * pParam->mb_width;
1192                            int force_direct = (((j*mb_width+i)==new_bound) && (j > 0)) ? 1 : 0; /* MTK decoder chipsets do NOT reset predMVs upon resync marker in BVOPs. We workaround this problem
1193                                                                                                                                                                        by placing the slice border on second MB in a row and then force the first MB to be direct mode */
1194                            pMB->mode = -1;
1195    
1196                            initialize_searchData(&Data_d, &Data_f, &Data_b, &Data_i,
1197                                              i, j, f_ref, f_refH->y, f_refV->y, f_refHV->y,
1198                                              b_ref, b_refH->y, b_refV->y, b_refHV->y,
1199                                              &frame->image, b_mb);
1200    
1201                            if (current_mb >= max_mbs) {
1202                                    /* we ME-ed all macroblocks we safely could. grab next portion */
1203                                    int above_count = *complete_count_above; /* sync point */
1204                                    if (above_count == pParam->mb_width) {
1205                                            /* full line above is ready */
1206                                            above_count = pParam->mb_width+1;
1207                                            if (j < stop_y-y_step) {
1208                                                    /* this is not last line, grab a portion of MBs from the next line too */
1209                                                    above_count += MAX(0, complete_count_above[1] - 1);
1210                                            }
1211                                    }
1212    
1213                                    max_mbs = current_mb + above_count - i - 1;
1214    
1215                                    if (current_mb >= max_mbs) {
1216                                            /* current workload is zero */
1217                                            i--;
1218                                            sched_yield();
1219                                            continue;
1220                                    }
1221                            }
1222    
1223    /* special case, if collocated block is SKIPed in P-VOP: encoding is forward (0,0), cpb=0 without further ado */
1224                            if (b_reference->coding_type != S_VOP)
1225                                    if (b_mb->mode == MODE_NOT_CODED) {
1226                                            pMB->mode = MODE_NOT_CODED;
1227                                            pMB->mvs[0] = pMB->b_mvs[0] = zeroMV;
1228                                            pMB->sad16 = 0;
1229                                            *complete_count_self = i+1;
1230                                            current_mb++;
1231                                            continue;
1232                                    }
1233    
1234    /* direct search comes first, because it (1) checks for SKIP-mode
1235            and (2) sets very good predictions for forward and backward search */
1236                            skip_sad = SearchDirect_initial(i, j, frame->motion_flags, TRB, TRD, pParam, pMB,
1237                                                                                            b_mb, &best_sad, &Data_d);
1238    
1239                            if (pMB->mode == MODE_DIRECT_NONE_MV) {
1240                                    pMB->sad16 = best_sad;
1241                                    pMB->cbp = 0;
1242                                    *complete_count_self = i+1;
1243                                    current_mb++;
1244                                    continue;
1245                            }
1246    
1247                            SearchBF_initial(i, j, frame->motion_flags, frame->fcode, pParam, pMB,
1248                                                    &f_predMV, &best_sad, MODE_FORWARD, &Data_f, Data_d.currentMV[1]);
1249    
1250                            SearchBF_initial(i, j, frame->motion_flags, frame->bcode, pParam, pMB,
1251                                                    &b_predMV, &best_sad, MODE_BACKWARD, &Data_b, Data_d.currentMV[2]);
1252    
1253                            if (frame->motion_flags&XVID_ME_BFRAME_EARLYSTOP)
1254                                    fb_thresh = best_sad;
1255                            else
1256                                    fb_thresh = best_sad + (best_sad>>1);
1257    
1258                            if (Data_f.iMinSAD[0] <= fb_thresh)
1259                                    SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_f);
1260    
1261                            if (Data_b.iMinSAD[0] <= fb_thresh)
1262                                    SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_b);
1263    
1264                            SearchInterpolate_initial(i, j, frame->motion_flags, pParam, &f_predMV, &b_predMV, &best_sad,
1265                                                                      &Data_i, Data_f.currentMV[0], Data_b.currentMV[0]);
1266    
1267                            if (((Data_i.iMinSAD[0] < best_sad +(best_sad>>3)) && !(frame->motion_flags&XVID_ME_FAST_MODEINTERPOLATE))
1268                                    || Data_i.iMinSAD[0] <= best_sad)
1269    
1270                                    SearchInterpolate_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_i);
1271    
1272                            if (Data_d.iMinSAD[0] <= 2*best_sad)
1273                                    if ((!(frame->motion_flags&XVID_ME_SKIP_DELTASEARCH) && (best_sad > 750))
1274                                            || (best_sad > 1000))
1275    
1276                                            SearchDirect_final(frame->motion_flags, b_mb, &best_sad, &Data_d);
1277    
1278                            /* final skip decision */
1279                            if ( (skip_sad < 2 * Data_d.iQuant * MAX_SAD00_FOR_SKIP )
1280                                    && ((100*best_sad)/(skip_sad+1) > FINAL_SKIP_THRESH) ) {
1281    
1282                                    Data_d.chromaSAD = 0; /* green light for chroma check */
1283    
1284                                    SkipDecisionB(pMB, &Data_d);
1285    
1286                                    if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */
1287                                            pMB->sad16 = skip_sad;
1288                                            pMB->cbp = 0;
1289                                            *complete_count_self = i+1;
1290                                            current_mb++;
1291                                            continue;
1292                                    }
1293                            }
1294    
1295                            if (frame->vop_flags & XVID_VOP_RD_BVOP)
1296                                    ModeDecision_BVOP_RD(&Data_d, &Data_b, &Data_f, &Data_i,
1297                                            pMB, b_mb, &f_predMV, &b_predMV, frame->motion_flags, frame->vop_flags, pParam, i, j, best_sad, force_direct);
1298                            else
1299                                    ModeDecision_BVOP_SAD(&Data_d, &Data_b, &Data_f, &Data_i, pMB, b_mb, &f_predMV, &b_predMV, force_direct);
1300    
1301                            *complete_count_self = i+1;
1302                            current_mb++;
1303                            maxMotionBVOP(&MVmaxF, &MVmaxB, pMB, Data_d.qpel);
1304                    }
1305    
1306                    complete_count_self++;
1307                    complete_count_above++;
1308            }
1309    
1310            h->minfcode = getMinFcode(MVmaxF);
1311            h->minbcode = getMinFcode(MVmaxB);
1312    }

Legend:
Removed from v.1567  
changed lines
  Added in v.1919

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4