Mercurial > libavcodec.hg
comparison vp3.c @ 3501:f77ee674da6f libavcodec
more simplifications
author | michael |
---|---|
date | Wed, 19 Jul 2006 22:21:45 +0000 |
parents | 2ff5efa33e3a |
children | 47c9a225c4d4 |
comparison
equal
deleted
inserted
replaced
3500:2ff5efa33e3a | 3501:f77ee674da6f |
---|---|
1367 int x, y; | 1367 int x, y; |
1368 int i = first_fragment; | 1368 int i = first_fragment; |
1369 | 1369 |
1370 short predicted_dc; | 1370 short predicted_dc; |
1371 | 1371 |
1372 /* validity flags for the left, up-left, up, and up-right fragments */ | |
1373 int fl, ful, fu, fur; | |
1374 | |
1375 /* DC values for the left, up-left, up, and up-right fragments */ | 1372 /* DC values for the left, up-left, up, and up-right fragments */ |
1376 int vl, vul, vu, vur; | 1373 int vl, vul, vu, vur; |
1377 | 1374 |
1378 /* indices for the left, up-left, up, and up-right fragments */ | 1375 /* indices for the left, up-left, up, and up-right fragments */ |
1379 int l, ul, u, ur; | 1376 int l, ul, u, ur; |
1382 * The 6 fields mean: | 1379 * The 6 fields mean: |
1383 * 0: up-left multiplier | 1380 * 0: up-left multiplier |
1384 * 1: up multiplier | 1381 * 1: up multiplier |
1385 * 2: up-right multiplier | 1382 * 2: up-right multiplier |
1386 * 3: left multiplier | 1383 * 3: left multiplier |
1387 * 4: mask | |
1388 * 5: right bit shift divisor (e.g., 7 means >>=7, a.k.a. div by 128) | |
1389 */ | 1384 */ |
1390 int predictor_transform[16][6] = { | 1385 int predictor_transform[16][4] = { |
1391 { 0, 0, 0, 0, 0, 0 }, | 1386 { 0, 0, 0, 0}, |
1392 { 0, 0, 0, 1, 0, 0 }, // PL | 1387 { 0, 0, 0,128}, // PL |
1393 { 0, 0, 1, 0, 0, 0 }, // PUR | 1388 { 0, 0,128, 0}, // PUR |
1394 { 0, 0, 53, 75, 127, 7 }, // PUR|PL | 1389 { 0, 0, 53, 75}, // PUR|PL |
1395 { 0, 1, 0, 0, 0, 0 }, // PU | 1390 { 0,128, 0, 0}, // PU |
1396 { 0, 1, 0, 1, 1, 1 }, // PU|PL | 1391 { 0, 64, 0, 64}, // PU|PL |
1397 { 0, 1, 0, 0, 0, 0 }, // PU|PUR | 1392 { 0,128, 0, 0}, // PU|PUR |
1398 { 0, 0, 53, 75, 127, 7 }, // PU|PUR|PL | 1393 { 0, 0, 53, 75}, // PU|PUR|PL |
1399 { 1, 0, 0, 0, 0, 0 }, // PUL | 1394 {128, 0, 0, 0}, // PUL |
1400 { 0, 0, 0, 1, 0, 0 }, // PUL|PL | 1395 { 0, 0, 0,128}, // PUL|PL |
1401 { 1, 0, 1, 0, 1, 1 }, // PUL|PUR | 1396 { 64, 0, 64, 0}, // PUL|PUR |
1402 { 0, 0, 53, 75, 127, 7 }, // PUL|PUR|PL | 1397 { 0, 0, 53, 75}, // PUL|PUR|PL |
1403 { 0, 1, 0, 0, 0, 0 }, // PUL|PU | 1398 { 0,128, 0, 0}, // PUL|PU |
1404 {-26, 29, 0, 29, 31, 5 }, // PUL|PU|PL | 1399 {-104,116, 0,116}, // PUL|PU|PL |
1405 { 3, 10, 3, 0, 15, 4 }, // PUL|PU|PUR | 1400 { 24, 80, 24, 0}, // PUL|PU|PUR |
1406 {-26, 29, 0, 29, 31, 5 } // PUL|PU|PUR|PL | 1401 {-104,116, 0,116} // PUL|PU|PUR|PL |
1407 }; | 1402 }; |
1408 | 1403 |
1409 /* This table shows which types of blocks can use other blocks for | 1404 /* This table shows which types of blocks can use other blocks for |
1410 * prediction. For example, INTRA is the only mode in this table to | 1405 * prediction. For example, INTRA is the only mode in this table to |
1411 * have a frame number of 0. That means INTRA blocks can only predict | 1406 * have a frame number of 0. That means INTRA blocks can only predict |
1443 /* reverse prediction if this block was coded */ | 1438 /* reverse prediction if this block was coded */ |
1444 if (s->all_fragments[i].coding_method != MODE_COPY) { | 1439 if (s->all_fragments[i].coding_method != MODE_COPY) { |
1445 | 1440 |
1446 current_frame_type = | 1441 current_frame_type = |
1447 compatible_frame[s->all_fragments[i].coding_method]; | 1442 compatible_frame[s->all_fragments[i].coding_method]; |
1448 debug_dc_pred(" frag %d: group %d, orig DC = %d, ", | 1443 debug_dc_pred(" frag %d: orig DC = %d, ", |
1449 i, -1, DC_COEFF(i)); | 1444 i, DC_COEFF(i)); |
1450 | 1445 |
1451 transform= 0; | 1446 transform= 0; |
1452 if(x){ | 1447 if(x){ |
1453 l= i-1; | 1448 l= i-1; |
1454 vl = DC_COEFF(l); | 1449 vl = DC_COEFF(l); |
1455 fl = FRAME_CODED(l) && COMPATIBLE_FRAME(l); | 1450 if(FRAME_CODED(l) && COMPATIBLE_FRAME(l)) |
1456 transform |= fl*PL; | 1451 transform |= PL; |
1457 } | 1452 } |
1458 if(y){ | 1453 if(y){ |
1459 u= i-fragment_width; | 1454 u= i-fragment_width; |
1460 vu = DC_COEFF(u); | 1455 vu = DC_COEFF(u); |
1461 fu = FRAME_CODED(u) && COMPATIBLE_FRAME(u); | 1456 if(FRAME_CODED(u) && COMPATIBLE_FRAME(u)) |
1462 transform |= fu*PU; | 1457 transform |= PU; |
1463 if(x){ | 1458 if(x){ |
1464 ul= i-fragment_width-1; | 1459 ul= i-fragment_width-1; |
1465 vul = DC_COEFF(ul); | 1460 vul = DC_COEFF(ul); |
1466 ful = FRAME_CODED(ul) && COMPATIBLE_FRAME(ul); | 1461 if(FRAME_CODED(ul) && COMPATIBLE_FRAME(ul)) |
1467 transform |= ful*PUL; | 1462 transform |= PUL; |
1468 } | 1463 } |
1469 if(x + 1 < fragment_width){ | 1464 if(x + 1 < fragment_width){ |
1470 ur= i-fragment_width+1; | 1465 ur= i-fragment_width+1; |
1471 vur = DC_COEFF(ur); | 1466 vur = DC_COEFF(ur); |
1472 fur = FRAME_CODED(ur) && COMPATIBLE_FRAME(ur); | 1467 if(FRAME_CODED(ur) && COMPATIBLE_FRAME(ur)) |
1473 transform |= fur*PUR; | 1468 transform |= PUR; |
1474 } | 1469 } |
1475 } | 1470 } |
1476 | 1471 |
1477 debug_dc_pred("transform = %d, ", transform); | 1472 debug_dc_pred("transform = %d, ", transform); |
1478 | 1473 |
1491 (predictor_transform[transform][0] * vul) + | 1486 (predictor_transform[transform][0] * vul) + |
1492 (predictor_transform[transform][1] * vu) + | 1487 (predictor_transform[transform][1] * vu) + |
1493 (predictor_transform[transform][2] * vur) + | 1488 (predictor_transform[transform][2] * vur) + |
1494 (predictor_transform[transform][3] * vl); | 1489 (predictor_transform[transform][3] * vl); |
1495 | 1490 |
1496 /* if there is a shift value in the transform, add | 1491 predicted_dc += (predicted_dc >> 15) & 127; |
1497 * the sign bit before the shift */ | 1492 predicted_dc >>= 7; |
1498 if (predictor_transform[transform][5] != 0) { | |
1499 predicted_dc += ((predicted_dc >> 15) & | |
1500 predictor_transform[transform][4]); | |
1501 predicted_dc >>= predictor_transform[transform][5]; | |
1502 } | |
1503 | 1493 |
1504 /* check for outranging on the [ul u l] and | 1494 /* check for outranging on the [ul u l] and |
1505 * [ul u ur l] predictors */ | 1495 * [ul u ur l] predictors */ |
1506 if ((transform == 13) || (transform == 15)) { | 1496 if ((transform == 13) || (transform == 15)) { |
1507 if (ABS(predicted_dc - vu) > 128) | 1497 if (ABS(predicted_dc - vu) > 128) |