[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.37, Mon Jan 13 14:33:24 2003 UTC
# Line 730  Line 730 
730                          FrameCodeP(pEnc, &bs, &bits, 1, 0);                          FrameCodeP(pEnc, &bs, &bits, 1, 0);
731                          bframes_count = 0;                          bframes_count = 0;
732    
733                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
734                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
735                          pFrame->intra = 0;                          pFrame->intra = 0;
736    
# Line 747  Line 747 
747                  FrameCodeB(pEnc, pEnc->bframes[pEnc->bframenum_head], &bs, &bits);                  FrameCodeB(pEnc, pEnc->bframes[pEnc->bframenum_head], &bs, &bits);
748                  pEnc->bframenum_head++;                  pEnc->bframenum_head++;
749    
750                  BitstreamPad(&bs);                  BitstreamPadAlways(&bs);
751                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
752                  pFrame->intra = 2;                  pFrame->intra = 2;
753    
# Line 776  Line 776 
776                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
777                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
778    
                         BitstreamPad(&bs);  
779    
780                          tmp = pEnc->current->seconds;                          tmp = pEnc->current->seconds;
781                          pEnc->current->seconds = 0; /* force time_base = 0 */                          pEnc->current->seconds = 0; /* force time_base = 0 */
782    
783                          BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);                          BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);
784                          pEnc->current->seconds = tmp;                          pEnc->current->seconds = tmp;
785    
786                            BitstreamPadAlways(&bs);
787                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
788                          pFrame->intra = 4;                          pFrame->intra = 4;
789    
# Line 859  Line 860 
860                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
861                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
862    
863                          BitstreamPutBits(&bs, 0x7f, 8);                  //      BitstreamPutBits(&bs, 0x7f, 8);
864                          pFrame->intra = 5;                          pFrame->intra = 5;
865                  }                  }
866    
# Line 1089  Line 1090 
1090                  goto bvop_loop;                  goto bvop_loop;
1091          }          }
1092    
1093          BitstreamPad(&bs);          BitstreamPadAlways(&bs);
1094          pFrame->length = BitstreamLength(&bs);          pFrame->length = BitstreamLength(&bs);
1095    
1096          if (pResult) {          if (pResult) {
# Line 1275  Line 1276 
1276    
1277          }          }
1278    
1279          BitstreamPutBits(&bs, 0xFFFF, 16);  //      BitstreamPutBits(&bs, 0xFFFF, 16);
1280          BitstreamPutBits(&bs, 0xFFFF, 16);  //      BitstreamPutBits(&bs, 0xFFFF, 16);
1281          BitstreamPad(&bs);          BitstreamPadAlways(&bs);
1282          pFrame->length = BitstreamLength(&bs);          pFrame->length = BitstreamLength(&bs);
1283    
1284          if (pResult) {          if (pResult) {
# Line 1468  Line 1469 
1469    
1470          if (intra) {          if (intra) {
1471                  if (!hint->rawhints) {                  if (!hint->rawhints) {
1472                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
1473                          hint->hintlength = BitstreamLength(&bs);                          hint->hintlength = BitstreamLength(&bs);
1474                  }                  }
1475                  return;                  return;
# Line 1574  Line 1575 
1575          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);          BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
1576    
1577          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
1578    
1579            BitstreamPadAlways(bs);
1580          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1581    
1582          *pBits = BitstreamPos(bs);          *pBits = BitstreamPos(bs);
# Line 1713  Line 1716 
1716                  generate_GMCimage(&pEnc->current->gmc_data, &pEnc->reference->image,                  generate_GMCimage(&pEnc->current->gmc_data, &pEnc->reference->image,
1717                                  pEnc->mbParam.mb_width, pEnc->mbParam.mb_height,                                  pEnc->mbParam.mb_width, pEnc->mbParam.mb_height,
1718                                  pEnc->mbParam.edged_width, pEnc->mbParam.edged_width/2,                                  pEnc->mbParam.edged_width, pEnc->mbParam.edged_width/2,
1719                                  pEnc->mbParam.m_fcode, 0, 0,                                  pEnc->mbParam.m_fcode, pEnc->mbParam.m_quarterpel, 0,
1720                                  pEnc->current->rounding_type, pEnc->current->mbs, &pEnc->vGMC);                                  pEnc->current->rounding_type, pEnc->current->mbs, &pEnc->vGMC);
1721    
1722          }          }
1723    
1724            set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
1725          if (vol_header)          if (vol_header)
1726                  BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);          {       BitstreamWriteVolHeader(bs, &pEnc->mbParam, pEnc->current);
1727                    BitstreamPadAlways(bs);
1728            }
1729    
         set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);  
1730          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1731    
1732          *pBits = BitstreamPos(bs);          *pBits = BitstreamPos(bs);
# Line 1738  Line 1743 
1743  /* 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 */
1744  /* 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 */
1745    
   
1746                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);
1747    
1748                          if (bIntra) {                          if (bIntra) {
# Line 1753  Line 1757 
1757                                  pEnc->current->sStat.kblks++;                                  pEnc->current->sStat.kblks++;
1758    
1759                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);
1760                                    stop_coding_timer();
1761                                  continue;                                  continue;
1762                          }                          }
1763    
# Line 1763  Line 1768 
1768                                          pEnc->mbParam.edged_width,65536);                                          pEnc->mbParam.edged_width,65536);
1769    
1770                                  if (iSAD <= pMB->sad16) {               /* mode decision GMC */                                  if (iSAD <= pMB->sad16) {               /* mode decision GMC */
1771    
1772                                          if (pEnc->mbParam.m_quarterpel)                                          if (pEnc->mbParam.m_quarterpel)
1773                                                  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;
1774                                          else                                          else
# Line 1774  Line 1780 
1780                                  } else {                                  } else {
1781                                          pMB->mcsel = 0;                                          pMB->mcsel = 0;
1782                                  }                                  }
1783                          } else                          } else {
                         {  
1784                                  pMB->mcsel = 0; /* just a precaution */                                  pMB->mcsel = 0; /* just a precaution */
1785                          }                          }
1786    
# Line 1813  Line 1818 
1818                                                                            dct_codes, qcoeff);                                                                            dct_codes, qcoeff);
1819                          }                          }
1820    
   
1821                          if (pMB->cbp || pMB->mvs[0].x || pMB->mvs[0].y ||                          if (pMB->cbp || pMB->mvs[0].x || pMB->mvs[0].y ||
1822                                     pMB->mvs[1].x || pMB->mvs[1].y || pMB->mvs[2].x ||                                     pMB->mvs[1].x || pMB->mvs[1].y || pMB->mvs[2].x ||
1823                                     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 1830 
1830    
1831                          /* Finished processing the MB, now check if to CODE or SKIP */                          /* Finished processing the MB, now check if to CODE or SKIP */
1832    
1833                          skip_possible = (pMB->cbp == 0) & (pMB->mode == MODE_INTER) &                          skip_possible = (pMB->cbp == 0) && (pMB->mode == MODE_INTER) &&
1834                                                          (pMB->dquant == NO_CHANGE);                                                          (pMB->dquant == NO_CHANGE);
1835    
1836                          if (pEnc->current->coding_type == S_VOP)                          if (pEnc->current->coding_type == S_VOP)
1837                                  skip_possible &= (pMB->mcsel == 1);                                  skip_possible &= (pMB->mcsel == 1);
1838                          else if (pEnc->current->coding_type == P_VOP) {                          else if (pEnc->current->coding_type == P_VOP) {
1839                                  if (pEnc->mbParam.m_quarterpel)                                  if (pEnc->mbParam.m_quarterpel)
1840                                          skip_possible &= (pMB->qmvs[0].x == 0) & (pMB->qmvs[0].y == 0);                                          skip_possible &= ( (pMB->qmvs[0].x == 0) && (pMB->qmvs[0].y == 0) );
1841                                  else                                  else
1842                                          skip_possible &= (pMB->mvs[0].x == 0) & (pMB->mvs[0].y == 0);                                          skip_possible &= ( (pMB->mvs[0].x == 0) && (pMB->mvs[0].y == 0) );
1843                          }                          }
1844    
1845                          if ( (pMB->mode == MODE_NOT_CODED) || (skip_possible)) {                          if ( (pMB->mode == MODE_NOT_CODED) || (skip_possible)) {
# Line 1873  Line 1877 
1877                                                  pMB->cbp = 0;                                                  pMB->cbp = 0;
1878                                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);                                                  MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);
1879                                                  stop_coding_timer();                                                  stop_coding_timer();
1880    
1881                                                  continue;       /* next MB */                                                  continue;       /* next MB */
1882                                          }                                          }
1883                                  }                                  }
# Line 1922  Line 1927 
1927    
1928                                  }                                  }
1929                          }                          }
1930    
1931                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);
1932                          stop_coding_timer();                          stop_coding_timer();
1933    
1934                  }                  }
1935          }          }
1936    

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

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