[cvs] / xvidcore / src / encoder.c Repository:
ViewVC logotype

Diff of /xvidcore/src/encoder.c

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

revision 1.76.2.35, Sat Jan 11 14:59:23 2003 UTC revision 1.76.2.43, Wed Feb 12 14:10:50 2003 UTC
# Line 229  Line 229 
229    
230          pEnc->bitrate = pParam->rc_bitrate;          pEnc->bitrate = pParam->rc_bitrate;
231    
232          pEnc->iFrameNum = 0;          pEnc->iFrameNum = -1;
233          pEnc->mbParam.iMaxKeyInterval = pParam->max_key_interval;          pEnc->mbParam.iMaxKeyInterval = pParam->max_key_interval;
234    
235          /* try to allocate frame memory */          /* try to allocate frame memory */
# Line 254  Line 254 
254    
255          /* try to allocate image memory */          /* try to allocate image memory */
256    
257  #ifdef _DEBUG_PSNR          if (pParam->global & XVID_GLOBAL_EXTRASTATS)
258          image_null(&pEnc->sOriginal);          image_null(&pEnc->sOriginal);
 #endif  
259    
260          image_null(&pEnc->f_refh);          image_null(&pEnc->f_refh);
261          image_null(&pEnc->f_refv);          image_null(&pEnc->f_refv);
# Line 270  Line 269 
269          image_null(&pEnc->vInterHV);          image_null(&pEnc->vInterHV);
270          image_null(&pEnc->vInterHVf);          image_null(&pEnc->vInterHVf);
271    
272  #ifdef _DEBUG_PSNR          if (pParam->global & XVID_GLOBAL_EXTRASTATS)
273          if (image_create          {       if (image_create
274                  (&pEnc->sOriginal, pEnc->mbParam.edged_width,                  (&pEnc->sOriginal, pEnc->mbParam.edged_width,
275                   pEnc->mbParam.edged_height) < 0)                   pEnc->mbParam.edged_height) < 0)
276                  goto xvid_err_memory3;                  goto xvid_err_memory3;
277  #endif          }
278    
279          if (image_create          if (image_create
280                  (&pEnc->f_refh, pEnc->mbParam.edged_width,                  (&pEnc->f_refh, pEnc->mbParam.edged_width,
# Line 326  Line 325 
325                  goto xvid_err_memory3;                  goto xvid_err_memory3;
326    
327    
         /* B Frames specific init */  
328    
329          pEnc->mbParam.global = pParam->global;          pEnc->mbParam.global = pParam->global;
330    
331            /* B Frames specific init */
332          pEnc->mbParam.max_bframes = pParam->max_bframes;          pEnc->mbParam.max_bframes = pParam->max_bframes;
333          pEnc->mbParam.bquant_ratio = pParam->bquant_ratio;          pEnc->mbParam.bquant_ratio = pParam->bquant_ratio;
334          pEnc->mbParam.bquant_offset = pParam->bquant_offset;          pEnc->mbParam.bquant_offset = pParam->bquant_offset;
# Line 464  Line 464 
464          }          }
465    
466    xvid_err_memory3:    xvid_err_memory3:
467  #ifdef _DEBUG_PSNR  
468          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,          if (pEnc->mbParam.global & XVID_GLOBAL_EXTRASTATS)
469            {       image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,
470                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
471  #endif          }
472    
473          image_destroy(&pEnc->f_refh, pEnc->mbParam.edged_width,          image_destroy(&pEnc->f_refh, pEnc->mbParam.edged_width,
474                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
# Line 583  Line 584 
584          image_destroy(&pEnc->f_refhv, pEnc->mbParam.edged_width,          image_destroy(&pEnc->f_refhv, pEnc->mbParam.edged_width,
585                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
586    
587  #ifdef _DEBUG_PSNR          if (pEnc->mbParam.global & XVID_GLOBAL_EXTRASTATS)
588          image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,          {       image_destroy(&pEnc->sOriginal, pEnc->mbParam.edged_width,
589                                    pEnc->mbParam.edged_height);                                    pEnc->mbParam.edged_height);
590  #endif          }
591    
592          /* Encoder structure */          /* Encoder structure */
593    
# Line 689  Line 690 
690          int input_valid = 1;          int input_valid = 1;
691          int bframes_count = 0;          int bframes_count = 0;
692    
 #ifdef _DEBUG_PSNR  
         float psnr;  
         char temp[128];  
 #endif  
   
693          ENC_CHECK(pEnc);          ENC_CHECK(pEnc);
694          ENC_CHECK(pFrame);          ENC_CHECK(pFrame);
695          ENC_CHECK(pFrame->image);          ENC_CHECK(pFrame->image);
# Line 730  Line 726 
726                          FrameCodeP(pEnc, &bs, &bits, 1, 0);                          FrameCodeP(pEnc, &bs, &bits, 1, 0);
727                          bframes_count = 0;                          bframes_count = 0;
728    
729                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
730                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
731                          pFrame->intra = 0;                          pFrame->intra = 0;
732    
733    
734                          emms();                          emms();
735    
736                            if (pResult) {
737                                    pResult->quant = pEnc->current->quant;
738                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
739                                    pResult->kblks = pEnc->current->sStat.kblks;
740                                    pResult->mblks = pEnc->current->sStat.mblks;
741                                    pResult->ublks = pEnc->current->sStat.ublks;
742                            }
743    
744                          return XVID_ERR_OK;                          return XVID_ERR_OK;
745                  }                  }
746    
# Line 747  Line 752 
752                  FrameCodeB(pEnc, pEnc->bframes[pEnc->bframenum_head], &bs, &bits);                  FrameCodeB(pEnc, pEnc->bframes[pEnc->bframenum_head], &bs, &bits);
753                  pEnc->bframenum_head++;                  pEnc->bframenum_head++;
754    
755                  BitstreamPad(&bs);                  BitstreamPadAlways(&bs);
756                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
757                  pFrame->intra = 2;                  pFrame->intra = 2;
758    
759                    if (pResult) {
760                            pResult->quant = pEnc->current->quant;
761                            pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
762                            pResult->kblks = pEnc->current->sStat.kblks;
763                            pResult->mblks = pEnc->current->sStat.mblks;
764                            pResult->ublks = pEnc->current->sStat.ublks;
765                    }
766    
767                  if (input_valid)                  if (input_valid)
768                          queue_image(pEnc, pFrame);                          queue_image(pEnc, pFrame);
769    
# Line 776  Line 789 
789                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
790                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
791    
                         BitstreamPad(&bs);  
792    
793                          tmp = pEnc->current->seconds;                          tmp = pEnc->current->seconds;
794                          pEnc->current->seconds = 0; /* force time_base = 0 */                          pEnc->current->seconds = 0; /* force time_base = 0 */
795    
796                          BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);                          BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);
797                          pEnc->current->seconds = tmp;                          pEnc->current->seconds = tmp;
798    
799                            BitstreamPadAlways(&bs);
800                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
801                          pFrame->intra = 4;                          pFrame->intra = 4;
802    
803                            if (pResult) {
804                                    pResult->quant = pEnc->current->quant;
805                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
806                                    pResult->kblks = pEnc->current->sStat.kblks;
807                                    pResult->mblks = pEnc->current->sStat.mblks;
808                                    pResult->ublks = pEnc->current->sStat.ublks;
809                            }
810    
811                          if (input_valid)                          if (input_valid)
812                                  queue_image(pEnc, pFrame);                                  queue_image(pEnc, pFrame);
813    
# Line 859  Line 881 
881                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
882                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
883    
884                          BitstreamPutBits(&bs, 0x7f, 8);                  //      BitstreamPutBits(&bs, 0x7f, 8);
885                          pFrame->intra = 5;                          pFrame->intra = 5;
886    
887                            if (pResult) {
888                                    /*
889                                     * We must decide what to put there because i know some apps
890                                     * are storing statistics about quantizers and just do
891                                     * stats[quant]++ or stats[quant-1]++
892                                     * transcode is one of these app with its 2pass module
893                                     */
894    
895                                    /*
896                                     * For now i prefer 31 than 0 that could lead to a segfault
897                                     * in transcode
898                                     */
899                                    pResult->quant = 31;
900    
901                                    pResult->hlength = 0;
902                                    pResult->kblks = 0;
903                                    pResult->mblks = 0;
904                                    pResult->ublks = 0;
905                            }
906    
907                    } else {
908    
909                            if (pResult) {
910                                    pResult->quant = pEnc->current->quant;
911                                    pResult->hlength = pFrame->length - (pEnc->current->sStat.iTextBits / 8);
912                                    pResult->kblks = pEnc->current->sStat.kblks;
913                                    pResult->mblks = pEnc->current->sStat.mblks;
914                                    pResult->ublks = pEnc->current->sStat.ublks;
915                            }
916    
917                  }                  }
918    
919                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
920    
921                  emms();                  emms();
922    
923                  return XVID_ERR_OK;                  return XVID_ERR_OK;
924          }          }
925    
# Line 896  Line 951 
951    
952                  inc_frame_num(pEnc);                  inc_frame_num(pEnc);
953    
954  #ifdef _DEBUG_PSNR                  if (pFrame->general & XVID_EXTRASTATS)
955                  image_copy(&pEnc->sOriginal, &pEnc->current->image,                  {       image_copy(&pEnc->sOriginal, &pEnc->current->image,
956                             pEnc->mbParam.edged_width, pEnc->mbParam.height);                             pEnc->mbParam.edged_width, pEnc->mbParam.height);
957  #endif                  }
958    
959                  emms();                  emms();
960    
# Line 1001  Line 1056 
1056                          }                          }
1057                          FrameCodeP(pEnc, &bs, &bits, 1, 0);                          FrameCodeP(pEnc, &bs, &bits, 1, 0);
1058                          bframes_count = 0;                          bframes_count = 0;
   
1059                          pFrame->intra = 0;                          pFrame->intra = 0;
1060    
1061                  } else {                  } else {
# Line 1025  Line 1079 
1079                   * NB : sequences like "IIBB" decode fine with msfdam but,                   * NB : sequences like "IIBB" decode fine with msfdam but,
1080                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
1081                   */                   */
1082          } else if (mode == P_VOP || pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) {          } else if (mode == P_VOP || mode == S_VOP || pEnc->bframenum_tail >= pEnc->mbParam.max_bframes) {
1083                  /*                  /*
1084                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
1085                   */                   */
# Line 1089  Line 1143 
1143                  goto bvop_loop;                  goto bvop_loop;
1144          }          }
1145    
1146          BitstreamPad(&bs);          BitstreamPadAlways(&bs);
1147          pFrame->length = BitstreamLength(&bs);          pFrame->length = BitstreamLength(&bs);
1148    
1149          if (pResult) {          if (pResult) {
# Line 1098  Line 1152 
1152                  pResult->kblks = pEnc->current->sStat.kblks;                  pResult->kblks = pEnc->current->sStat.kblks;
1153                  pResult->mblks = pEnc->current->sStat.mblks;                  pResult->mblks = pEnc->current->sStat.mblks;
1154                  pResult->ublks = pEnc->current->sStat.ublks;                  pResult->ublks = pEnc->current->sStat.ublks;
         }  
   
         emms();  
1155    
1156  #ifdef _DEBUG_PSNR                  if (pFrame->general & XVID_EXTRASTATS)
1157          psnr =                  {       pResult->sse_y =
1158                  image_psnr(&pEnc->sOriginal, &pEnc->current->image,                                  plane_sse( pEnc->sOriginal.y, pEnc->current->image.y,
1159                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,
1160                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
1161    
1162          printf("PSNR: %f\n", psnr);                          pResult->sse_u =
1163  //      DEBUG(temp);                                  plane_sse( pEnc->sOriginal.u, pEnc->current->image.u,
1164  #endif                                                     pEnc->mbParam.edged_width/2, pEnc->mbParam.width/2,
1165                                                       pEnc->mbParam.height/2);
1166    
1167                            pResult->sse_v =
1168                                    plane_sse( pEnc->sOriginal.v, pEnc->current->image.v,
1169                                                       pEnc->mbParam.edged_width/2, pEnc->mbParam.width/2,
1170                                                       pEnc->mbParam.height/2);
1171                    }
1172            }
1173    
1174            emms();
1175    
1176          if (pFrame->quant == 0) {          if (pFrame->quant == 0) {
1177                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,
# Line 1145  Line 1206 
1206          uint32_t bits;          uint32_t bits;
1207          uint16_t write_vol_header = 0;          uint16_t write_vol_header = 0;
1208    
 #ifdef _DEBUG_PSNR  
1209          float psnr;          float psnr;
1210          uint8_t temp[128];          uint8_t temp[128];
 #endif  
1211    
1212          start_global_timer();          start_global_timer();
1213    
# Line 1179  Line 1238 
1238                  return XVID_ERR_FORMAT;                  return XVID_ERR_FORMAT;
1239          stop_conv_timer();          stop_conv_timer();
1240    
1241  #ifdef _DEBUG_PSNR          if (pFrame->general & XVID_EXTRASTATS)
1242          image_copy(&pEnc->sOriginal, &pEnc->current->image,          {       image_copy(&pEnc->sOriginal, &pEnc->current->image,
1243                             pEnc->mbParam.edged_width, pEnc->mbParam.height);                             pEnc->mbParam.edged_width, pEnc->mbParam.height);
1244  #endif          }
1245    
1246          emms();          emms();
1247    
# Line 1259  Line 1318 
1318          }          }
1319    
1320          if (pFrame->intra < 0) {          if (pFrame->intra < 0) {
1321                  if ((pEnc->iFrameNum == 0)                  if ((pEnc->iFrameNum == -1)
1322                          || ((pEnc->mbParam.iMaxKeyInterval > 0)                          || ((pEnc->mbParam.iMaxKeyInterval > 0)
1323                                  && (pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval))) {                                  && (pEnc->iFrameNum >= pEnc->mbParam.iMaxKeyInterval))) {
1324                          pFrame->intra = FrameCodeI(pEnc, &bs, &bits);                          pFrame->intra = FrameCodeI(pEnc, &bs, &bits);
# Line 1275  Line 1334 
1334    
1335          }          }
1336    
1337          BitstreamPutBits(&bs, 0xFFFF, 16);  //      BitstreamPutBits(&bs, 0xFFFF, 16);
1338          BitstreamPutBits(&bs, 0xFFFF, 16);  //      BitstreamPutBits(&bs, 0xFFFF, 16);
1339          BitstreamPad(&bs);          BitstreamPadAlways(&bs);
1340          pFrame->length = BitstreamLength(&bs);          pFrame->length = BitstreamLength(&bs);
1341    
1342          if (pResult) {          if (pResult) {
# Line 1294  Line 1353 
1353                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,                  RateControlUpdate(&pEnc->rate_control, pEnc->current->quant,
1354                                                    pFrame->length, pFrame->intra);                                                    pFrame->length, pFrame->intra);
1355          }          }
1356  #ifdef _DEBUG_PSNR          if (pFrame->general & XVID_EXTRASTATS)
1357            {
1358          psnr =          psnr =
1359                  image_psnr(&pEnc->sOriginal, &pEnc->current->image,                  image_psnr(&pEnc->sOriginal, &pEnc->current->image,
1360                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,                                     pEnc->mbParam.edged_width, pEnc->mbParam.width,
1361                                     pEnc->mbParam.height);                                     pEnc->mbParam.height);
1362    
1363          snprintf(temp, 127, "PSNR: %f\n", psnr);          snprintf(temp, 127, "PSNR: %f\n", psnr);
1364  //      DEBUG(temp);          }
 #endif  
1365    
1366          pEnc->iFrameNum++;          pEnc->iFrameNum++;
1367    
# Line 1468  Line 1527 
1527    
1528          if (intra) {          if (intra) {
1529                  if (!hint->rawhints) {                  if (!hint->rawhints) {
1530                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
1531                          hint->hintlength = BitstreamLength(&bs);                          hint->hintlength = BitstreamLength(&bs);
1532                  }                  }
1533                  return;                  return;
# Line 1574  Line 1633 
1633          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
1634    
1635          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
1636    
1637            BitstreamPadAlways(bs);
1638          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1639    
1640          *pBits = BitstreamPos(bs);          *pBits = BitstreamPos(bs);
# Line 1713  Line 1774 
1774                  generate_GMCimage(&pEnc->current->gmc_data, &pEnc->reference->image,                  generate_GMCimage(&pEnc->current->gmc_data, &pEnc->reference->image,
1775                                  pEnc->mbParam.mb_width, pEnc->mbParam.mb_height,                                  pEnc->mbParam.mb_width, pEnc->mbParam.mb_height,
1776                                  pEnc->mbParam.edged_width, pEnc->mbParam.edged_width/2,                                  pEnc->mbParam.edged_width, pEnc->mbParam.edged_width/2,
1777                                  pEnc->mbParam.m_fcode, 0, 0,                                  pEnc->mbParam.m_fcode, pEnc->mbParam.m_quarterpel, 0,
1778                                  pEnc->current->rounding_type, pEnc->current->mbs, &pEnc->vGMC);                                  pEnc->current->rounding_type, pEnc->current->mbs, &pEnc->vGMC);
1779    
1780          }          }
1781    
1782            set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
1783          if (vol_header)          if (vol_header)
1784                  BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);          {       BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
1785                    BitstreamPadAlways(bs);
1786            }
1787    
         set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);  
1788          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1789    
1790          *pBits = BitstreamPos(bs);          *pBits = BitstreamPos(bs);
# Line 1738  Line 1801 
1801  /* Mode decision: Check, if the block should be INTRA / INTER or GMC-coded */  /* Mode decision: Check, if the block should be INTRA / INTER or GMC-coded */
1802  /* For a start, leave INTRA decision as is, only choose only between INTER/GMC  - gruel, 9.1.2002 */  /* For a start, leave INTRA decision as is, only choose only between INTER/GMC  - gruel, 9.1.2002 */
1803    
   
1804                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);
1805    
1806                          if (bIntra) {                          if (bIntra) {
# Line 1753  Line 1815 
1815                                  pEnc->current->sStat.kblks++;                                  pEnc->current->sStat.kblks++;
1816    
1817                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);
1818                                    stop_coding_timer();
1819                                  continue;                                  continue;
1820                          }                          }
1821    
# Line 1762  Line 1825 
1825                                          pEnc->vGMC.y + 16*y*pEnc->mbParam.edged_width + 16*x,                                          pEnc->vGMC.y + 16*y*pEnc->mbParam.edged_width + 16*x,
1826                                          pEnc->mbParam.edged_width,65536);                                          pEnc->mbParam.edged_width,65536);
1827    
1828                                    if (pEnc->current->motion_flags & PMV_CHROMA16) {
1829                                            iSAD += sad8(pEnc->current->image.u + 8*y*(pEnc->mbParam.edged_width/2) + 8*x,
1830                                            pEnc->vGMC.u + 8*y*(pEnc->mbParam.edged_width/2) + 8*x, pEnc->mbParam.edged_width/2);
1831    
1832                                            iSAD += sad8(pEnc->current->image.v + 8*y*(pEnc->mbParam.edged_width/2) + 8*x,
1833                                            pEnc->vGMC.v + 8*y*(pEnc->mbParam.edged_width/2) + 8*x, pEnc->mbParam.edged_width/2);
1834                                    }
1835    
1836                                  if (iSAD <= pMB->sad16) {               /* mode decision GMC */                                  if (iSAD <= pMB->sad16) {               /* mode decision GMC */
1837    
1838                                          if (pEnc->mbParam.m_quarterpel)                                          if (pEnc->mbParam.m_quarterpel)
1839                                                  pMB->qmvs[0] = pMB->qmvs[1] =pMB->qmvs[2] =pMB->qmvs[3] = pMB->amv;                                                  pMB->qmvs[0] = pMB->qmvs[1] =pMB->qmvs[2] =pMB->qmvs[3] = pMB->amv;
1840                                          else                                          else
# Line 1774  Line 1846 
1846                                  } else {                                  } else {
1847                                          pMB->mcsel = 0;                                          pMB->mcsel = 0;
1848                                  }                                  }
1849                          } else                          } else {
                         {  
1850                                  pMB->mcsel = 0; /* just a precaution */                                  pMB->mcsel = 0; /* just a precaution */
1851                          }                          }
1852    
# Line 1813  Line 1884 
1884                                                                            dct_codes, qcoeff);                                                                            dct_codes, qcoeff);
1885                          }                          }
1886    
   
1887                          if (pMB->cbp || pMB->mvs[0].x || pMB->mvs[0].y ||                          if (pMB->cbp || pMB->mvs[0].x || pMB->mvs[0].y ||
1888                                     pMB->mvs[1].x || pMB->mvs[1].y || pMB->mvs[2].x ||                                     pMB->mvs[1].x || pMB->mvs[1].y || pMB->mvs[2].x ||
1889                                     pMB->mvs[2].y || pMB->mvs[3].x || pMB->mvs[3].y) {                                     pMB->mvs[2].y || pMB->mvs[3].x || pMB->mvs[3].y) {
# Line 1826  Line 1896 
1896    
1897                          /* Finished processing the MB, now check if to CODE or SKIP */                          /* Finished processing the MB, now check if to CODE or SKIP */
1898    
1899                          skip_possible = (pMB->cbp == 0) & (pMB->mode == MODE_INTER) &                          skip_possible = (pMB->cbp == 0) && (pMB->mode == MODE_INTER) &&
1900                                                          (pMB->dquant == NO_CHANGE);                                                          (pMB->dquant == NO_CHANGE);
1901    
1902                          if (pEnc->current->coding_type == S_VOP)                          if (pEnc->current->coding_type == S_VOP)
1903                                  skip_possible &= (pMB->mcsel == 1);                                  skip_possible &= (pMB->mcsel == 1);
1904                          else if (pEnc->current->coding_type == P_VOP) {                          else if (pEnc->current->coding_type == P_VOP) {
1905                                  if (pEnc->mbParam.m_quarterpel)                                  if (pEnc->mbParam.m_quarterpel)
1906                                          skip_possible &= (pMB->qmvs[0].x == 0) & (pMB->qmvs[0].y == 0);                                          skip_possible &= ( (pMB->qmvs[0].x == 0) && (pMB->qmvs[0].y == 0) );
1907                                  else                                  else
1908                                          skip_possible &= (pMB->mvs[0].x == 0) & (pMB->mvs[0].y == 0);                                          skip_possible &= ( (pMB->mvs[0].x == 0) && (pMB->mvs[0].y == 0) );
1909                          }                          }
1910    
1911                          if ( (pMB->mode == MODE_NOT_CODED) || (skip_possible)) {                          if ( (pMB->mode == MODE_NOT_CODED) || (skip_possible)) {
# Line 1873  Line 1943 
1943                                                  pMB->cbp = 0;                                                  pMB->cbp = 0;
1944                                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);                                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);
1945                                                  stop_coding_timer();                                                  stop_coding_timer();
1946    
1947                                                  continue;       /* next MB */                                                  continue;       /* next MB */
1948                                          }                                          }
1949                                  }                                  }
# Line 1922  Line 1993 
1993    
1994                                  }                                  }
1995                          }                          }
1996    
1997                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);
1998                          stop_coding_timer();                          stop_coding_timer();
1999    
2000                  }                  }
2001          }          }
2002    

Legend:
Removed from v.1.76.2.35  
changed lines
  Added in v.1.76.2.43

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