[svn] / branches / release-1_0-branch / xvidcore / src / prediction / mbprediction.c Repository:
ViewVC logotype

Diff of /branches/release-1_0-branch/xvidcore/src/prediction/mbprediction.c

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

revision 652, Sun Nov 17 00:35:33 2002 UTC revision 723, Sun Dec 15 01:21:12 2002 UTC
# Line 51  Line 51 
51   *  exception also makes it possible to release a modified version which   *  exception also makes it possible to release a modified version which
52   *  carries forward this exception.   *  carries forward this exception.
53   *   *
54   * $Id: mbprediction.c,v 1.10 2002-11-17 00:35:33 edgomez Exp $   * $Id: mbprediction.c,v 1.12 2002-12-15 01:21:12 edgomez Exp $
55   *   *
56   ****************************************************************************/   ****************************************************************************/
57    
# Line 123  Line 123 
123          const int16_t *pTop = default_acdc_values;          const int16_t *pTop = default_acdc_values;
124          const int16_t *pDiag = default_acdc_values;          const int16_t *pDiag = default_acdc_values;
125    
126          uint32_t index = x + y * mb_width;      // current macroblock          uint32_t index = x + y * mb_width;      /* current macroblock */
127          int *acpred_direction = &pMBs[index].acpred_directions[block];          int *acpred_direction = &pMBs[index].acpred_directions[block];
128          uint32_t i;          uint32_t i;
129    
130          left = top = diag = current = 0;          left = top = diag = current = 0;
131    
132          // grab left,top and diag macroblocks          /* grab left,top and diag macroblocks */
133    
134          // left macroblock          /* left macroblock  */
135    
136          if (x && mbpos >= bound + 1  &&          if (x && mbpos >= bound + 1  &&
137                  (pMBs[index - 1].mode == MODE_INTRA ||                  (pMBs[index - 1].mode == MODE_INTRA ||
# Line 139  Line 139 
139    
140                  left = pMBs[index - 1].pred_values[0];                  left = pMBs[index - 1].pred_values[0];
141                  left_quant = pMBs[index - 1].quant;                  left_quant = pMBs[index - 1].quant;
142                  //DEBUGI("LEFT", *(left+MBPRED_SIZE));                  /*DEBUGI("LEFT", *(left+MBPRED_SIZE)); */
143          }          }
144          // top macroblock          /* top macroblock */
145    
146          if (mbpos >= bound + (int)mb_width &&          if (mbpos >= bound + (int)mb_width &&
147                  (pMBs[index - mb_width].mode == MODE_INTRA ||                  (pMBs[index - mb_width].mode == MODE_INTRA ||
# Line 150  Line 150 
150                  top = pMBs[index - mb_width].pred_values[0];                  top = pMBs[index - mb_width].pred_values[0];
151                  top_quant = pMBs[index - mb_width].quant;                  top_quant = pMBs[index - mb_width].quant;
152          }          }
153          // diag macroblock          /* diag macroblock  */
154    
155          if (x && mbpos >= bound + (int)mb_width + 1 &&          if (x && mbpos >= bound + (int)mb_width + 1 &&
156                  (pMBs[index - 1 - mb_width].mode == MODE_INTRA ||                  (pMBs[index - 1 - mb_width].mode == MODE_INTRA ||
# Line 161  Line 161 
161    
162          current = pMBs[index].pred_values[0];          current = pMBs[index].pred_values[0];
163    
164          // now grab pLeft, pTop, pDiag _blocks_          /* now grab pLeft, pTop, pDiag _blocks_  */
165    
166          switch (block) {          switch (block) {
167    
# Line 228  Line 228 
228                  break;                  break;
229          }          }
230    
231          //  determine ac prediction direction & ac/dc predictor          /*  determine ac prediction direction & ac/dc predictor */
232          //  place rescaled ac/dc predictions into predictors[] for later use          /*  place rescaled ac/dc predictions into predictors[] for later use */
233    
234          if (ABS(pLeft[0] - pDiag[0]) < ABS(pDiag[0] - pTop[0])) {          if (ABS(pLeft[0] - pDiag[0]) < ABS(pDiag[0] - pTop[0])) {
235                  *acpred_direction = 1;  // vertical                  *acpred_direction = 1;  /* vertical */
236                  predictors[0] = DIV_DIV(pTop[0], iDcScaler);                  predictors[0] = (int16_t)(DIV_DIV(pTop[0], iDcScaler));
237                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
238                          predictors[i] = rescale(top_quant, current_quant, pTop[i]);                          predictors[i] = rescale(top_quant, current_quant, pTop[i]);
239                  }                  }
240          } else {          } else {
241                  *acpred_direction = 2;  // horizontal                  *acpred_direction = 2;  /* horizontal */
242                  predictors[0] = DIV_DIV(pLeft[0], iDcScaler);                  predictors[0] = (int16_t)(DIV_DIV(pLeft[0], iDcScaler));
243                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
244                          predictors[i] = rescale(left_quant, current_quant, pLeft[i + 7]);                          predictors[i] = rescale(left_quant, current_quant, pLeft[i + 7]);
245                  }                  }
# Line 265  Line 265 
265    
266          DPRINTF(DPRINTF_COEFF,"predictor[0] %i", predictors[0]);          DPRINTF(DPRINTF_COEFF,"predictor[0] %i", predictors[0]);
267    
268          dct_codes[0] += predictors[0];  // dc prediction          dct_codes[0] += predictors[0];  /* dc prediction */
269          pCurrent[0] = dct_codes[0] * iDcScaler;          pCurrent[0] = (int16_t)(dct_codes[0] * iDcScaler);
270    
271          if (acpred_direction == 1) {          if (acpred_direction == 1) {
272                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
# Line 297  Line 297 
297    
298    
299    
300  // ******************************************************************  /* ****************************************************************** */
301  // ******************************************************************  /* ****************************************************************** */
302    
303  /* encoder: subtract predictors from qcoeff[] and calculate S1/S2  /* encoder: subtract predictors from qcoeff[] and calculate S1/S2
304    
# Line 324  Line 324 
324    
325          /* store current coeffs to pred_values[] for future prediction */          /* store current coeffs to pred_values[] for future prediction */
326    
327          pCurrent[0] = qcoeff[0] * iDcScaler;          pCurrent[0] = (int16_t)(qcoeff[0] * iDcScaler);
328          for (i = 1; i < 8; i++) {          for (i = 1; i < 8; i++) {
329                  pCurrent[i] = qcoeff[i];                  pCurrent[i] = qcoeff[i];
330                  pCurrent[i + 7] = qcoeff[i * 8];                  pCurrent[i + 7] = qcoeff[i * 8];
# Line 344  Line 344 
344                          S1 += ABS(level);                          S1 += ABS(level);
345                          predictors[i] = level;                          predictors[i] = level;
346                  }                  }
347          } else                                          // acpred_direction == 2          } else                                          /* acpred_direction == 2 */
348          {          {
349                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
350                          int16_t level;                          int16_t level;
# Line 412  Line 412 
412    
413                  }                  }
414    
415                  if (S < 0)                              // dont predict                  if (S < 0)                              /* dont predict */
416                  {                  {
417                          for (j = 0; j < 6; j++) {                          for (j = 0; j < 6; j++) {
418                                  pMB->acpred_directions[j] = 0;                                  pMB->acpred_directions[j] = 0;

Legend:
Removed from v.652  
changed lines
  Added in v.723

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