[cvs] / xvidcore / src / quant / quant_h263.c Repository:
ViewVC logotype

Diff of /xvidcore/src/quant/quant_h263.c

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

revision 1.5, Tue Nov 26 23:44:11 2002 UTC revision 1.6, Sun Dec 15 01:21:12 2002 UTC
# Line 95  Line 95 
95                            const uint32_t dcscalar)                            const uint32_t dcscalar)
96  {  {
97          const uint32_t mult = multipliers[quant];          const uint32_t mult = multipliers[quant];
98          const uint16_t quant_m_2 = quant << 1;          const uint16_t quant_m_2 = (uint16_t)(quant << 1);
99          uint32_t i;          uint32_t i;
100    
101          coeff[0] = DIV_DIV(data[0], (int32_t) dcscalar);          coeff[0] = (int16_t)(DIV_DIV(data[0], (int32_t) dcscalar));
102    
103          for (i = 1; i < 64; i++) {          for (i = 1; i < 64; i++) {
104                  int16_t acLevel = data[i];                  int16_t acLevel = data[i];
# Line 109  Line 109 
109                                  coeff[i] = 0;                                  coeff[i] = 0;
110                                  continue;                                  continue;
111                          }                          }
112                          acLevel = (acLevel * mult) >> SCALEBITS;                          acLevel = (int16_t)(((uint32_t)acLevel * mult) >> SCALEBITS);
113                          coeff[i] = -acLevel;                          coeff[i] = -acLevel;
114                  } else {                  } else {
115                          if (acLevel < quant_m_2) {                          if (acLevel < quant_m_2) {
116                                  coeff[i] = 0;                                  coeff[i] = 0;
117                                  continue;                                  continue;
118                          }                          }
119                          acLevel = (acLevel * mult) >> SCALEBITS;                          acLevel = (int16_t)(((uint32_t)acLevel * mult) >> SCALEBITS);
120                          coeff[i] = acLevel;                          coeff[i] = acLevel;
121                  }                  }
122          }          }
# Line 132  Line 132 
132                            const uint32_t quant)                            const uint32_t quant)
133  {  {
134          const uint32_t mult = multipliers[quant];          const uint32_t mult = multipliers[quant];
135          const uint16_t quant_m_2 = quant << 1;          const uint16_t quant_m_2 = (uint16_t)(quant << 1);
136          const uint16_t quant_d_2 = quant >> 1;          const uint16_t quant_d_2 = (uint16_t)(quant >> 1);
137          int sum = 0;          int sum = 0;
138          uint32_t i;          uint32_t i;
139    
# Line 147  Line 147 
147                                  continue;                                  continue;
148                          }                          }
149    
150                          acLevel = (acLevel * mult) >> SCALEBITS;                          acLevel = (int16_t)(((uint32_t)acLevel * mult) >> SCALEBITS);
151                          sum += acLevel;         /* sum += |acLevel| */                          sum += acLevel;         /* sum += |acLevel| */
152                          coeff[i] = -acLevel;                          coeff[i] = -acLevel;
153                  } else {                  } else {
# Line 156  Line 156 
156                                  coeff[i] = 0;                                  coeff[i] = 0;
157                                  continue;                                  continue;
158                          }                          }
159                          acLevel = (acLevel * mult) >> SCALEBITS;                          acLevel = (int16_t)(((uint32_t)acLevel * mult) >> SCALEBITS);
160                          sum += acLevel;                          sum += acLevel;
161                          coeff[i] = acLevel;                          coeff[i] = acLevel;
162                  }                  }
# Line 179  Line 179 
179          const int32_t quant_add = (quant & 1 ? quant : quant - 1);          const int32_t quant_add = (quant & 1 ? quant : quant - 1);
180          uint32_t i;          uint32_t i;
181    
182          data[0] = coeff[0] * dcscalar;          data[0] = (int16_t)(coeff[0] * dcscalar);
183          if (data[0] < -2048) {          if (data[0] < -2048) {
184                  data[0] = -2048;                  data[0] = -2048;
185          } else if (data[0] > 2047) {          } else if (data[0] > 2047) {
# Line 213  Line 213 
213                                  const int16_t * coeff,                                  const int16_t * coeff,
214                                  const uint32_t quant)                                  const uint32_t quant)
215  {  {
216          const uint16_t quant_m_2 = quant << 1;          const uint16_t quant_m_2 = (uint16_t)(quant << 1);
217          const uint16_t quant_add = (quant & 1 ? quant : quant - 1);          const uint16_t quant_add = (uint16_t)(quant & 1 ? quant : quant - 1);
218          uint32_t i;          uint32_t i;
219    
220          for (i = 0; i < 64; i++) {          for (i = 0; i < 64; i++) {

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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