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

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

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

revision 1450, Sun May 9 21:21:31 2004 UTC revision 1451, Fri May 21 14:40:15 2004 UTC
# Line 20  Line 20 
20   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   *   *
23   * $Id: mbprediction.c,v 1.14 2004-03-22 22:36:24 edgomez Exp $   * $Id: mbprediction.c,v 1.15 2004-05-21 14:40:15 edgomez Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 67  Line 67 
67                           uint32_t current_quant,                           uint32_t current_quant,
68                           int32_t iDcScaler,                           int32_t iDcScaler,
69                           int16_t predictors[8],                           int16_t predictors[8],
70                          const int bound)                           const int bound,
71                             const int bsversion)
72    
73  {  {
74          const int mbpos = (y * mb_width) + x;          const int mbpos = (y * mb_width) + x;
# Line 184  Line 185 
185                  break;                  break;
186          }          }
187    
188          /*          /* determine ac prediction direction & ac/dc predictor place rescaled ac/dc
189           * determine ac prediction direction & ac/dc predictor place rescaled ac/dc           * predictions into predictors[] for later use */
          * predictions into predictors[] for later use  
          */  
190    
191            /* Workaround: Bitstream versions <= 32 used to have a wrong predictor
192             * stored as it wasn't clipped to the [-2048, 2047] range. We only
193             * use the right predictors for bs versions > 32 */
194    #define BUGGY_CLIPPING_BS_VERSION 32
195          if (abs(pLeft[0] - pDiag[0]) < abs(pDiag[0] - pTop[0])) {          if (abs(pLeft[0] - pDiag[0]) < abs(pDiag[0] - pTop[0])) {
196                  *acpred_direction = 1;  /* vertical */                  *acpred_direction = 1;  /* vertical */
197                  predictors[0] = DIV_DIV(pTop[0], iDcScaler);                  predictors[0] = DIV_DIV(pTop[0], iDcScaler);
198                    if (bsversion == 0 || bsversion > BUGGY_CLIPPING_BS_VERSION)
199                            predictors[0] = CLIP(predictors[0], -2048, 2047);
200                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
201                          predictors[i] = rescale(top_quant, current_quant, pTop[i]);                          predictors[i] = rescale(top_quant, current_quant, pTop[i]);
202                  }                  }
203          } else {          } else {
204                  *acpred_direction = 2;  /* horizontal */                  *acpred_direction = 2;  /* horizontal */
205                  predictors[0] = DIV_DIV(pLeft[0], iDcScaler);                  predictors[0] = DIV_DIV(pLeft[0], iDcScaler);
206                    if (bsversion == 0 || bsversion > BUGGY_CLIPPING_BS_VERSION)
207                            predictors[0] = CLIP(predictors[0], -2048, 2047);
208                  for (i = 1; i < 8; i++) {                  for (i = 1; i < 8; i++) {
209                          predictors[i] = rescale(left_quant, current_quant, pLeft[i + 7]);                          predictors[i] = rescale(left_quant, current_quant, pLeft[i + 7]);
210                  }                  }
# Line 420  Line 427 
427                          iDcScaler = get_dc_scaler(iQuant, j<4);                          iDcScaler = get_dc_scaler(iQuant, j<4);
428    
429                          predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64],                          predict_acdc(frame->mbs, x, y, mb_width, j, &qcoeff[j * 64],
430                                                   iQuant, iDcScaler, predictors[j], 0);                                                   iQuant, iDcScaler, predictors[j], 0, 0);
431    
432                          if ((frame->vop_flags & XVID_VOP_HQACPRED))                          if ((frame->vop_flags & XVID_VOP_HQACPRED))
433                                  S += calc_acdc_bits(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]);                                  S += calc_acdc_bits(pMB, j, &qcoeff[j * 64], iDcScaler, predictors[j]);

Legend:
Removed from v.1450  
changed lines
  Added in v.1451

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