[svn] / branches / dev-api-4 / xvidcore / src / quant / quant_mpeg.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/quant/quant_mpeg.c

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

revision 1174, Tue Oct 7 13:02:35 2003 UTC revision 1176, Thu Oct 9 18:50:22 2003 UTC
# Line 19  Line 19 
19   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: quant_mpeg.c,v 1.1.2.1 2003-10-07 13:02:35 edgomez Exp $   * $Id: quant_mpeg.c,v 1.1.2.2 2003-10-09 18:50:22 edgomez Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 84  Line 84 
84          const uint32_t quantd = ((VM18P * quant) + (VM18Q / 2)) / VM18Q;          const uint32_t quantd = ((VM18P * quant) + (VM18Q / 2)) / VM18Q;
85          const uint32_t mult = multipliers[quant];          const uint32_t mult = multipliers[quant];
86          const int16_t *intra_matrix = get_intra_matrix();          const int16_t *intra_matrix = get_intra_matrix();
         uint32_t sum = 0;  
87          int i;          int i;
88    
89          coeff[0] = DIV_DIV(data[0], (int32_t) dcscalar);          coeff[0] = DIV_DIV(data[0], (int32_t) dcscalar);
         sum += coeff[0];  
90    
91          for (i = 1; i < 64; i++) {          for (i = 1; i < 64; i++) {
92                  if (data[i] < 0) {                  if (data[i] < 0) {
# Line 96  Line 94 
94    
95                          level = ((level << 4) + (intra_matrix[i] >> 1)) / intra_matrix[i];                          level = ((level << 4) + (intra_matrix[i] >> 1)) / intra_matrix[i];
96                          level = ((level + quantd) * mult) >> SCALEBITS;                          level = ((level + quantd) * mult) >> SCALEBITS;
                         sum += level;  
97                          coeff[i] = -(int16_t) level;                          coeff[i] = -(int16_t) level;
98                  } else if (data[i] > 0) {                  } else if (data[i] > 0) {
99                          uint32_t level = data[i];                          uint32_t level = data[i];
100    
101                          level = ((level << 4) + (intra_matrix[i] >> 1)) / intra_matrix[i];                          level = ((level << 4) + (intra_matrix[i] >> 1)) / intra_matrix[i];
102                          level = ((level + quantd) * mult) >> SCALEBITS;                          level = ((level + quantd) * mult) >> SCALEBITS;
                         sum += level;  
103                          coeff[i] = level;                          coeff[i] = level;
104                  } else {                  } else {
105                          coeff[i] = 0;                          coeff[i] = 0;
106                  }                  }
107          }          }
108    
109          return(sum);          return(0);
110  }  }
111    
112  /* quantize inter-block  /* quantize inter-block

Legend:
Removed from v.1174  
changed lines
  Added in v.1176

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