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: mbcoding.c,v 1.51 2005-04-04 23:49:37 edgomez Exp $ |
* $Id: mbcoding.c,v 1.52 2005-09-13 12:12:15 suxen_drol Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
1072 |
break; |
break; |
1073 |
} |
} |
1074 |
coeff += run; |
coeff += run; |
1075 |
|
|
1076 |
|
#ifdef _DEBUG |
1077 |
|
if(coeff>=64) { |
1078 |
|
DPRINTF(XVID_DEBUG_ERROR,"error: overflow in coefficient index\n"); |
1079 |
|
return; |
1080 |
|
} |
1081 |
|
#endif |
1082 |
|
|
1083 |
block[scan[coeff]] = level; |
block[scan[coeff]] = level; |
1084 |
|
|
1085 |
DPRINTF(XVID_DEBUG_COEFF,"block[%i] %i\n", scan[coeff], level); |
DPRINTF(XVID_DEBUG_COEFF,"block[%i] %i\n", scan[coeff], level); |
1121 |
} |
} |
1122 |
p += run; |
p += run; |
1123 |
|
|
1124 |
|
#ifdef _DEBUG |
1125 |
|
if(p>=64) { |
1126 |
|
DPRINTF(XVID_DEBUG_ERROR,"error: overflow in coefficient index\n"); |
1127 |
|
return; |
1128 |
|
} |
1129 |
|
#endif |
1130 |
|
|
1131 |
if (level < 0) { |
if (level < 0) { |
1132 |
level = level*quant_m_2 - quant_add; |
level = level*quant_m_2 - quant_add; |
1133 |
block[scan[p]] = (level >= -2048 ? level : -2048); |
block[scan[p]] = (level >= -2048 ? level : -2048); |
1163 |
} |
} |
1164 |
p += run; |
p += run; |
1165 |
|
|
1166 |
|
#ifdef _DEBUG |
1167 |
|
if(p>=64) { |
1168 |
|
DPRINTF(XVID_DEBUG_ERROR,"error: overflow in coefficient index\n"); |
1169 |
|
return; |
1170 |
|
} |
1171 |
|
#endif |
1172 |
|
|
1173 |
if (level < 0) { |
if (level < 0) { |
1174 |
level = ((2 * -level + 1) * matrix[scan[p]] * quant) >> 4; |
level = ((2 * -level + 1) * matrix[scan[p]] * quant) >> 4; |
1175 |
block[scan[p]] = (level <= 2048 ? -level : -2048); |
block[scan[p]] = (level <= 2048 ? -level : -2048); |