[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.64, Wed Jul 24 23:17:19 2002 UTC revision 1.65, Sun Jul 28 13:06:45 2002 UTC
# Line 56  Line 56 
56  #include "image/image.h"  #include "image/image.h"
57  #ifdef BFRAMES  #ifdef BFRAMES
58  #include "image/font.h"  #include "image/font.h"
59    #include "motion/sad.h"
60  #endif  #endif
61  #include "motion/motion.h"  #include "motion/motion.h"
62  #include "bitstream/cbp.h"  #include "bitstream/cbp.h"
# Line 1556  Line 1557 
1557    
1558    
1559  #define INTRA_THRESHOLD 0.5  #define INTRA_THRESHOLD 0.5
1560    #define BFRAME_SKIP_THRESHHOLD 16
1561    
1562  static int  static int
1563  FrameCodeP(Encoder * pEnc,  FrameCodeP(Encoder * pEnc,
# Line 1570  Line 1572 
1572          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);
1573    
1574          int iLimit;          int iLimit;
1575          uint32_t x, y;          int k;
1576            int x, y;
1577          int iSearchRange;          int iSearchRange;
1578          int bIntra;          int bIntra;
1579    
# Line 1698  Line 1701 
1701                          }                          }
1702    
1703                          start_timer();                          start_timer();
1704    
1705                            /* Finished processing the MB, now check if to CODE or SKIP */
1706    
1707                            if (pMB->cbp == 0 && pMB->mode == MODE_INTER && pMB->mvs[0].x == 0 &&
1708                                    pMB->mvs[0].y == 0) {
1709    
1710    /* This is a candidate for SKIPping, but check intermediate B-frames first */
1711    
1712    #ifdef BFRAMES
1713                                    int iSAD=BFRAME_SKIP_THRESHHOLD;
1714                                    int bSkip=1;
1715    
1716                                    for (k=pEnc->bframenum_head; k< pEnc->bframenum_tail; k++)
1717                                    {
1718                                            iSAD = sad16(pEnc->reference->image.y + 16*y*pEnc->mbParam.edged_width + 16*x,
1719                                                                    pEnc->bframes[k]->image.y + 16*y*pEnc->mbParam.edged_width + 16*x,
1720                                                                    pEnc->mbParam.edged_width,BFRAME_SKIP_THRESHHOLD);
1721                                            if (iSAD >= BFRAME_SKIP_THRESHHOLD)
1722                                            {       bSkip = 0;
1723                                                    break;
1724                                            }
1725                                    }
1726                                    if (!bSkip)
1727                                    {
1728                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->sStat);                          MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->sStat);
1729                                            pMB->cbp = 0x80;                /* trick! so cbp!=0, but still nothing is written to bs */
1730                                    }
1731                                    else
1732                                            MBSkip(bs);
1733    
1734    
1735    #else
1736                                            MBSkip(bs);     /* without B-frames, no precautions are needed */
1737    
1738    #endif
1739    
1740                            } else {
1741                                    MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->sStat);
1742                            }
1743    
1744                          stop_coding_timer();                          stop_coding_timer();
1745                  }                  }
1746          }          }

Legend:
Removed from v.1.64  
changed lines
  Added in v.1.65

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