[XviD-devel]
=?gb2312?B?w8+/wg==?=
ke_ke_ke at 263.net
Wed Mar 26 20:07:24 CET 2003
Hi,
I'm reading the source code of xvidcore-0.9.1. There is something in src\motion\sad.c making me a little puzzled.Can anyone help me?
The part annoying me is listed here:
uint32_t
sad16bi_c(const uint8_t * const cur,
const uint8_t * const ref1,
const uint8_t * const ref2,
const uint32_t stride)
{
uint32_t sad = 0;
uint32_t i, j;
uint8_t const *ptr_cur = cur;
uint8_t const *ptr_ref1 = ref1;
uint8_t const *ptr_ref2 = ref2;
for (j = 0; j < 16; j++) {
for (i = 0; i < 16; i++) {
int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2;
if (pixel < 0) {
pixel = 0;
} else if (pixel > 255) {
pixel = 255;
}
Since ptr_ref1[i] and ptr_ref2[i] are two unsigned byte,why is it possible that pixel < 0 or pixel > 255 ?Thanks very much
==========================
263µç×ÓÓʼþ£ÐÅÀµÓÊ×Ôרҵ
More information about the XviD-devel
mailing list