[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.54, Wed Nov 19 15:42:38 2003 UTC revision 1.95.2.55, Thu Nov 20 12:07:19 2003 UTC
# Line 776  Line 776 
776                                  frame->mbs[j*pEnc->mbParam.mb_width + i].dquant = 0;                                  frame->mbs[j*pEnc->mbParam.mb_width + i].dquant = 0;
777                          }                          }
778                  }                  }
779                  frame->mbs[0].quant = data.quant; /* BEFORE2 will not affect the quant in stats */                  frame->mbs[0].quant = data.quant; /* FRAME will not affect the quant in stats */
780          }          }
781    
782    
783  }  }
784    
785    
   
   
786  static __inline void inc_frame_num(Encoder * pEnc)  static __inline void inc_frame_num(Encoder * pEnc)
787  {  {
788          pEnc->current->frame_num = pEnc->m_framenum;          pEnc->current->frame_num = pEnc->m_framenum;
# Line 800  Line 798 
798          pEnc->m_framenum--;     /* debug ticker */          pEnc->m_framenum--;     /* debug ticker */
799  }  }
800    
801    static __inline void
802    MBSetDquant(MACROBLOCK * pMB, int x, int y, MBParam * mbParam)
803    {
804            if (pMB->cbp == 0) {
805                    /* we want to code dquant but the quantizer value will not be used yet
806                            let's find out if we can postpone dquant to next MB
807                    */
808                    if (x == mbParam->mb_width-1 && y == mbParam->mb_height-1) {
809                            pMB->dquant = 0; /* it's the last MB of all, the easiest case */
810                            return;
811                    } else {
812                            MACROBLOCK * next = pMB + 1;
813                            const MACROBLOCK * prev = pMB - 1;
814                            if (next->mode != MODE_INTER4V && next->mode != MODE_NOT_CODED)
815                                    /* mode allows dquant change in the future */
816                                    if (abs(next->quant - prev->quant) <= 2) {
817                                            /* quant change is not out of range */
818                                            pMB->quant = prev->quant;
819                                            pMB->dquant = 0;
820                                            next->dquant = next->quant - prev->quant;
821                                            return;
822                                    }
823                    }
824            }
825            /* couldn't skip this dquant */
826            pMB->mode = MODE_INTER_Q;
827    }
828    
829    
830    
831  static __inline void  static __inline void
# Line 1603  Line 1629 
1629    
1630                          stop_comp_timer();                          stop_comp_timer();
1631    
                         if (pMB->dquant != 0) {  
                                 pMB->mode = MODE_INTER_Q;  
                         }  
   
1632                          pMB->field_pred = 0;                          pMB->field_pred = 0;
1633    
1634                          if (pMB->mode != MODE_NOT_CODED)                          if (pMB->mode != MODE_NOT_CODED)
# Line 1615  Line 1637 
1637                                                                            dct_codes, qcoeff);                                                                            dct_codes, qcoeff);
1638                          }                          }
1639    
1640                            if (pMB->dquant != 0)
1641                                    MBSetDquant(pMB, x, y, &pEnc->mbParam);
1642    
1643    
1644                          if (pMB->cbp || pMB->mvs[0].x || pMB->mvs[0].y ||                          if (pMB->cbp || pMB->mvs[0].x || pMB->mvs[0].y ||
1645                                     pMB->mvs[1].x || pMB->mvs[1].y || pMB->mvs[2].x ||                                     pMB->mvs[1].x || pMB->mvs[1].y || pMB->mvs[2].x ||
1646                                     pMB->mvs[2].y || pMB->mvs[3].x || pMB->mvs[3].y) {                                     pMB->mvs[2].y || pMB->mvs[3].x || pMB->mvs[3].y) {

Legend:
Removed from v.1.95.2.54  
changed lines
  Added in v.1.95.2.55

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