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

Diff of /xvidcore/src/prediction/mbprediction.c

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

revision 1.4, Wed Jun 12 20:38:40 2002 UTC revision 1.7.2.1, Sat Jan 4 06:14:33 2003 UTC
# Line 42  Line 42 
42    *                                                                            *    *                                                                            *
43    *  Revision history:                                                         *    *  Revision history:                                                         *
44    *                                                                            *    *                                                                            *
45      *  29.06.2002 predict_acdc() bounding                                        *
46    *  12.12.2001 improved calc_acdc_prediction; removed need for memcpy         *    *  12.12.2001 improved calc_acdc_prediction; removed need for memcpy         *
47    *  15.12.2001 moved pmv displacement to motion estimation                    *    *  15.12.2001 moved pmv displacement to motion estimation                    *
48    *  30.11.2001 mmx cbp support                                                *    *  30.11.2001 mmx cbp support                                                *
# Line 49  Line 50 
50    *                                                                            *    *                                                                            *
51    ******************************************************************************/    ******************************************************************************/
52    
53    #include "../global.h"
54  #include "../encoder.h"  #include "../encoder.h"
55  #include "mbprediction.h"  #include "mbprediction.h"
56  #include "../utils/mbfunctions.h"  #include "../utils/mbfunctions.h"
57  #include "../bitstream/cbp.h"  #include "../bitstream/cbp.h"
58    
59    
 #define ABS(X) (((X)>0)?(X):-(X))  
 #define DIV_DIV(A,B)    ( (A) > 0 ? ((A)+((B)>>1))/(B) : ((A)-((B)>>1))/(B) )  
   
   
60  static int __inline  static int __inline
61  rescale(int predict_quant,  rescale(int predict_quant,
62                  int current_quant,                  int current_quant,
# Line 90  Line 88 
88                           int16_t qcoeff[64],                           int16_t qcoeff[64],
89                           uint32_t current_quant,                           uint32_t current_quant,
90                           int32_t iDcScaler,                           int32_t iDcScaler,
91                           int16_t predictors[8])                           int16_t predictors[8],
92                            const int bound)
93    
94  {  {
95            const int mbpos = (y * mb_width) + x;
96          int16_t *left, *top, *diag, *current;          int16_t *left, *top, *diag, *current;
97    
98          int32_t left_quant = current_quant;          int32_t left_quant = current_quant;
# Line 111  Line 112 
112    
113          // left macroblock          // left macroblock
114    
115          if (x &&          if (x && mbpos >= bound + 1  &&
116                  (pMBs[index - 1].mode == MODE_INTRA ||                  (pMBs[index - 1].mode == MODE_INTRA ||
117                   pMBs[index - 1].mode == MODE_INTRA_Q)) {                   pMBs[index - 1].mode == MODE_INTRA_Q)) {
118    
# Line 121  Line 122 
122          }          }
123          // top macroblock          // top macroblock
124    
125          if (y &&          if (mbpos >= bound + (int)mb_width &&
126                  (pMBs[index - mb_width].mode == MODE_INTRA ||                  (pMBs[index - mb_width].mode == MODE_INTRA ||
127                   pMBs[index - mb_width].mode == MODE_INTRA_Q)) {                   pMBs[index - mb_width].mode == MODE_INTRA_Q)) {
128    
# Line 130  Line 131 
131          }          }
132          // diag macroblock          // diag macroblock
133    
134          if (x && y &&          if (x && mbpos >= bound + (int)mb_width + 1 &&
135                  (pMBs[index - 1 - mb_width].mode == MODE_INTRA ||                  (pMBs[index - 1 - mb_width].mode == MODE_INTRA ||
136                   pMBs[index - 1 - mb_width].mode == MODE_INTRA_Q)) {                   pMBs[index - 1 - mb_width].mode == MODE_INTRA_Q)) {
137    
# Line 241  Line 242 
242          int16_t *pCurrent = pMB->pred_values[block];          int16_t *pCurrent = pMB->pred_values[block];
243          uint32_t i;          uint32_t i;
244    
245            DPRINTF(DPRINTF_COEFF,"predictor[0] %i", predictors[0]);
246    
247          dct_codes[0] += predictors[0];  // dc prediction          dct_codes[0] += predictors[0];  // dc prediction
248          pCurrent[0] = dct_codes[0] * iDcScaler;          pCurrent[0] = dct_codes[0] * iDcScaler;
249    
# Line 248  Line 251 
251                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
252                          int level = dct_codes[i] + predictors[i];                          int level = dct_codes[i] + predictors[i];
253    
254                            DPRINTF(DPRINTF_COEFF,"predictor[%i] %i",i, predictors[i]);
255    
256                          dct_codes[i] = level;                          dct_codes[i] = level;
257                          pCurrent[i] = level;                          pCurrent[i] = level;
258                          pCurrent[i + 7] = dct_codes[i * 8];                          pCurrent[i + 7] = dct_codes[i * 8];
# Line 255  Line 260 
260          } else if (acpred_direction == 2) {          } else if (acpred_direction == 2) {
261                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
262                          int level = dct_codes[i * 8] + predictors[i];                          int level = dct_codes[i * 8] + predictors[i];
263                            DPRINTF(DPRINTF_COEFF,"predictor[%i] %i",i*8, predictors[i]);
264    
265                          dct_codes[i * 8] = level;                          dct_codes[i * 8] = level;
266                          pCurrent[i + 7] = level;                          pCurrent[i + 7] = level;
# Line 379  Line 385 
385                          iDcScaler = get_dc_scaler(iQuant, (j < 4) ? 1 : 0);                          iDcScaler = get_dc_scaler(iQuant, (j < 4) ? 1 : 0);
386    
387                          predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64],                          predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64],
388                                                   iQuant, iDcScaler, predictors[j]);                                                   iQuant, iDcScaler, predictors[j], 0);
389    
390                          S += calc_acdc(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]);                          S += calc_acdc(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]);
391    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.7.2.1

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