[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.95.2.31, Sat Jun 28 15:49:40 2003 UTC revision 1.95.2.34, Mon Jul 28 12:28:55 2003 UTC
# Line 1196  Line 1196 
1196                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "IVOP");                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 200, "IVOP");
1197                  }                  }
1198    
1199                    pEnc->iFrameNum = 1;
1200    
1201                  /* ---- update vol flags at IVOP ----------- */                  /* ---- update vol flags at IVOP ----------- */
1202                  pEnc->current->vol_flags = pEnc->mbParam.vol_flags = frame->vol_flags;                  pEnc->current->vol_flags = pEnc->mbParam.vol_flags = frame->vol_flags;
# Line 1355  Line 1356 
1356    
1357          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);          set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);
1358    
1359          BitstreamPadAlways(bs);          BitstreamPad(bs);
1360    
1361          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, pEnc->current, 1);
1362    
1363          pEnc->current->sStat.iTextBits = 0;          pEnc->current->sStat.iTextBits = 0;
# Line 1394  Line 1396 
1396          }          }
1397          emms();          emms();
1398    
1399  /* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */          BitstreamPadAlways(bs); /* next_start_code() at the end of VideoObjectPlane() */
1400  #if 0  
         /* for divx5 compatibility, we must always pad between the packed p and b frames */  
         if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0)  
 #endif  
                 BitstreamPadAlways(bs);  
 #if 0  
         else  
                 BitstreamPad(bs);  
 #endif  
1401      pEnc->current->length = (BitstreamPos(bs) - bits) / 8;      pEnc->current->length = (BitstreamPos(bs) - bits) / 8;
1402    
1403          pEnc->fMvPrevSigma = -1;          pEnc->fMvPrevSigma = -1;
# Line 1544  Line 1538 
1538          set_timecodes(current,reference,pParam->fbase);          set_timecodes(current,reference,pParam->fbase);
1539          if (vol_header)          if (vol_header)
1540          {       BitstreamWriteVolHeader(bs, &pEnc->mbParam);          {       BitstreamWriteVolHeader(bs, &pEnc->mbParam);
1541                  BitstreamPadAlways(bs);                  BitstreamPad(bs);
1542          }          }
1543    
1544          BitstreamWriteVopHeader(bs, &pEnc->mbParam, current, 1);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, current, 1);
# Line 1558  Line 1552 
1552                          MACROBLOCK *pMB =                          MACROBLOCK *pMB =
1553                                  &current->mbs[x + y * pParam->mb_width];                                  &current->mbs[x + y * pParam->mb_width];
1554    
 /* Mode decision: Check, if the block should be INTRA / INTER or GMC-coded */  
 /* For a start, leave INTRA decision as is, only choose only between INTER/GMC  - gruel, 9.1.2002 */  
   
1555                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);
1556    
1557                          if (bIntra) {                          if (bIntra) {
# Line 1579  Line 1570 
1570                                  continue;                                  continue;
1571                          }                          }
1572    
                         if (current->coding_type == S_VOP) {  
   
                                 int32_t iSAD = sad16(current->image.y + 16*y*pParam->edged_width + 16*x,  
                                         pEnc->vGMC.y + 16*y*pParam->edged_width + 16*x,  
                                         pParam->edged_width, 65536);  
   
                                 if (current->motion_flags & XVID_ME_CHROMA16) {  
                                         iSAD += sad8(current->image.u + 8*y*(pParam->edged_width/2) + 8*x,  
                                         pEnc->vGMC.u + 8*y*(pParam->edged_width/2) + 8*x, pParam->edged_width/2);  
   
                                         iSAD += sad8(current->image.v + 8*y*(pParam->edged_width/2) + 8*x,  
                                         pEnc->vGMC.v + 8*y*(pParam->edged_width/2) + 8*x, pParam->edged_width/2);  
                                 }  
   
                                 if (iSAD <= pMB->sad16) {               /* mode decision GMC */  
   
                                         if ((pParam->vol_flags & XVID_VOL_QUARTERPEL))  
                                                 pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = pMB->amv;  
                                         else  
                                                 pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = pMB->amv;  
   
                                         pMB->mode = MODE_INTER;  
                                         pMB->mcsel = 1;  
                                         pMB->sad16 = iSAD;  
                                 } else {  
                                         pMB->mcsel = 0;  
                                 }  
                         } else {  
                                 pMB->mcsel = 0; /* just a precaution */  
                         }  
   
1573                          start_timer();                          start_timer();
1574                          MBMotionCompensation(pMB, x, y, &reference->image,                          MBMotionCompensation(pMB, x, y, &reference->image,
1575                                                                   &pEnc->vInterH, &pEnc->vInterV,                                                                   &pEnc->vInterH, &pEnc->vInterV,
# Line 1824  Line 1784 
1784          }          }
1785          */          */
1786    
1787  /* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */          BitstreamPadAlways(bs); /* next_start_code() at the end of VideoObjectPlane() */
 #if 0  
         /* for divx5 compatibility, we must always pad between the packed p and b frames */  
         if ((pParam->global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0)  
 #endif  
                 BitstreamPadAlways(bs);  
 #if 0  
         else  
                 BitstreamPad(bs);  
 #endif  
1788    
1789      current->length = (BitstreamPos(bs) - bits) / 8;      current->length = (BitstreamPos(bs) - bits) / 8;
1790    
# Line 1954  Line 1905 
1905    
1906          /* TODO: dynamic fcode/bcode ??? */          /* TODO: dynamic fcode/bcode ??? */
1907    
1908      BitstreamPadAlways(bs);      BitstreamPadAlways(bs); /* next_start_code() at the end of VideoObjectPlane() */
1909          frame->length = (BitstreamPos(bs) - bits) / 8;          frame->length = (BitstreamPos(bs) - bits) / 8;
1910    
1911  #ifdef BFRAMES_DEC_DEBUG  #ifdef BFRAMES_DEC_DEBUG

Legend:
Removed from v.1.95.2.31  
changed lines
  Added in v.1.95.2.34

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