aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cavs.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-07-09 22:41:42 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-07-09 22:41:42 +0000
commit21227514de650da3de297acce893175230f04beb (patch)
treec99cd2c8597f06c3c04779a87fe8dcf87937c61b /libavcodec/cavs.c
parentb2846effb7320d869821d32e29238a5d72c6f802 (diff)
downloadffmpeg-21227514de650da3de297acce893175230f04beb.tar.gz
simplify
Originally committed as revision 5696 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/cavs.c')
-rw-r--r--libavcodec/cavs.c49
1 files changed, 16 insertions, 33 deletions
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index 3972428408..88b37f1610 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -576,6 +576,7 @@ static void mv_pred(AVSContext *h, enum mv_loc_t nP, enum mv_loc_t nC,
vector_t *mvA = &h->mv[nP-1];
vector_t *mvB = &h->mv[nP-4];
vector_t *mvC = &h->mv[nC];
+ vector_t *mvP2 = NULL;
mvP->ref = ref;
mvP->dist = h->dist[mvP->ref];
@@ -592,42 +593,24 @@ static void mv_pred(AVSContext *h, enum mv_loc_t nP, enum mv_loc_t nC,
}
/* if there is only one suitable candidate, take it */
if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) {
- mvP->x = mvA->x;
- mvP->y = mvA->y;
+ mvP2= mvA;
} else if((mvA->ref < 0) && (mvB->ref >= 0) && (mvC->ref < 0)) {
- mvP->x = mvB->x;
- mvP->y = mvB->y;
+ mvP2= mvB;
} else if((mvA->ref < 0) && (mvB->ref < 0) && (mvC->ref >= 0)) {
- mvP->x = mvC->x;
- mvP->y = mvC->y;
- } else {
- switch(mode) {
- case MV_PRED_LEFT:
- if(mvA->ref == mvP->ref) {
- mvP->x = mvA->x;
- mvP->y = mvA->y;
- } else
- mv_pred_median(h, mvP, mvA, mvB, mvC);
- break;
- case MV_PRED_TOP:
- if(mvB->ref == mvP->ref) {
- mvP->x = mvB->x;
- mvP->y = mvB->y;
- } else
- mv_pred_median(h, mvP, mvA, mvB, mvC);
- break;
- case MV_PRED_TOPRIGHT:
- if(mvC->ref == mvP->ref) {
- mvP->x = mvC->x;
- mvP->y = mvC->y;
- } else
- mv_pred_median(h, mvP, mvA, mvB, mvC);
- break;
- default:
- mv_pred_median(h, mvP, mvA, mvB, mvC);
- break;
- }
+ mvP2= mvC;
+ } else if(mode == MV_PRED_LEFT && mvA->ref == ref){
+ mvP2= mvA;
+ } else if(mode == MV_PRED_TOP && mvB->ref == ref){
+ mvP2= mvB;
+ } else if(mode == MV_PRED_TOPRIGHT && mvC->ref == ref){
+ mvP2= mvC;
}
+ if(mvP2){
+ mvP->x = mvP2->x;
+ mvP->y = mvP2->y;
+ }else
+ mv_pred_median(h, mvP, mvA, mvB, mvC);
+
if(mode < MV_PRED_PSKIP) {
mvP->x += get_se_golomb(&h->s.gb);
mvP->y += get_se_golomb(&h->s.gb);