26 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 |
* |
* |
29 |
* $Id: encoder.c,v 1.94 2003-02-19 10:08:20 chl Exp $ |
* $Id: encoder.c,v 1.95 2003-02-19 21:30:52 edgomez Exp $ |
30 |
* |
* |
31 |
****************************************************************************/ |
****************************************************************************/ |
32 |
|
|
677 |
uint16_t x, y; |
uint16_t x, y; |
678 |
Bitstream bs; |
Bitstream bs; |
679 |
uint32_t bits; |
uint32_t bits; |
680 |
int mode; |
int mode = -1; /* Just to shut up compiler warning */ |
681 |
|
|
682 |
int input_valid = 1; |
int input_valid = 1; |
683 |
int bframes_count = 0; |
int bframes_count = 0; |
1434 |
return; |
return; |
1435 |
} |
} |
1436 |
|
|
1437 |
pEnc->current->fcode = |
pEnc->current->fcode = (hint->rawhints) ? |
1438 |
(hint->rawhints) ? hint->mvhint.fcode : BitstreamGetBits(&bs, |
(uint32_t)hint->mvhint.fcode : BitstreamGetBits(&bs, FCODEBITS); |
|
FCODEBITS); |
|
1439 |
|
|
1440 |
length = pEnc->current->fcode + 5; |
length = pEnc->current->fcode + 5; |
1441 |
high = 1 << (length - 1); |
high = 1 << (length - 1); |
1450 |
VECTOR tmp; |
VECTOR tmp; |
1451 |
int vec; |
int vec; |
1452 |
|
|
1453 |
pMB->mode = |
pMB->mode = (hint->rawhints) ? |
1454 |
(hint->rawhints) ? bhint->mode : BitstreamGetBits(&bs, |
(uint32_t)bhint->mode : BitstreamGetBits(&bs, MODEBITS); |
|
MODEBITS); |
|
1455 |
|
|
1456 |
pMB->mode = (pMB->mode == MODE_INTER_Q) ? MODE_INTER : pMB->mode; |
pMB->mode = (pMB->mode == MODE_INTER_Q) ? MODE_INTER : pMB->mode; |
1457 |
pMB->mode = (pMB->mode == MODE_INTRA_Q) ? MODE_INTRA : pMB->mode; |
pMB->mode = (pMB->mode == MODE_INTRA_Q) ? MODE_INTRA : pMB->mode; |
1458 |
|
|
1459 |
if (pMB->mode == MODE_INTER) { |
if (pMB->mode == MODE_INTER) { |
1460 |
tmp.x = |
tmp.x = (hint->rawhints) ? |
1461 |
(hint->rawhints) ? bhint->mvs[0].x : BitstreamGetBits(&bs, |
bhint->mvs[0].x : (int)BitstreamGetBits(&bs, length); |
1462 |
length); |
tmp.y = (hint->rawhints) ? |
1463 |
tmp.y = |
bhint->mvs[0].y : (int)BitstreamGetBits(&bs, length); |
|
(hint->rawhints) ? bhint->mvs[0].y : BitstreamGetBits(&bs, |
|
|
length); |
|
1464 |
tmp.x -= (tmp.x >= high) ? high * 2 : 0; |
tmp.x -= (tmp.x >= high) ? high * 2 : 0; |
1465 |
tmp.y -= (tmp.y >= high) ? high * 2 : 0; |
tmp.y -= (tmp.y >= high) ? high * 2 : 0; |
1466 |
|
|
1474 |
} |
} |
1475 |
} else if (pMB->mode == MODE_INTER4V) { |
} else if (pMB->mode == MODE_INTER4V) { |
1476 |
for (vec = 0; vec < 4; ++vec) { |
for (vec = 0; vec < 4; ++vec) { |
1477 |
tmp.x = |
tmp.x = (hint->rawhints) ? |
1478 |
(hint->rawhints) ? bhint->mvs[vec]. |
bhint->mvs[vec].x : (int)BitstreamGetBits(&bs, length); |
1479 |
x : BitstreamGetBits(&bs, length); |
tmp.y = (hint->rawhints) ? |
1480 |
tmp.y = |
bhint->mvs[vec].y : (int)BitstreamGetBits(&bs, length); |
|
(hint->rawhints) ? bhint->mvs[vec]. |
|
|
y : BitstreamGetBits(&bs, length); |
|
1481 |
tmp.x -= (tmp.x >= high) ? high * 2 : 0; |
tmp.x -= (tmp.x >= high) ? high * 2 : 0; |
1482 |
tmp.y -= (tmp.y >= high) ? high * 2 : 0; |
tmp.y -= (tmp.y >= high) ? high * 2 : 0; |
1483 |
|
|