Revision 35c8b9c0
libavcodec/h264_direct.c | ||
---|---|---|
30 | 30 |
#include "avcodec.h" |
31 | 31 |
#include "mpegvideo.h" |
32 | 32 |
#include "h264.h" |
33 |
#include "h264_mvpred.h" |
|
34 | 33 |
#include "rectangle.h" |
35 | 34 |
|
36 | 35 |
//#undef NDEBUG |
... | ... | |
225 | 224 |
|
226 | 225 |
/* ref = min(neighbors) */ |
227 | 226 |
for(list=0; list<2; list++){ |
228 |
int refa = h->ref_cache[list][scan8[0] - 1];
|
|
229 |
int refb = h->ref_cache[list][scan8[0] - 8];
|
|
227 |
int left_ref = h->ref_cache[list][scan8[0] - 1];
|
|
228 |
int top_ref = h->ref_cache[list][scan8[0] - 8];
|
|
230 | 229 |
int refc = h->ref_cache[list][scan8[0] - 8 + 4]; |
231 |
if(refc == PART_NOT_AVAILABLE) |
|
230 |
const int16_t *C= h->mv_cache[list][ scan8[0] - 8 + 4]; |
|
231 |
if(refc == PART_NOT_AVAILABLE){ |
|
232 | 232 |
refc = h->ref_cache[list][scan8[0] - 8 - 1]; |
233 |
ref[list] = FFMIN3((unsigned)refa, (unsigned)refb, (unsigned)refc); |
|
233 |
C = h-> mv_cache[list][scan8[0] - 8 - 1]; |
|
234 |
} |
|
235 |
ref[list] = FFMIN3((unsigned)left_ref, (unsigned)top_ref, (unsigned)refc); |
|
234 | 236 |
if(ref[list] >= 0){ |
235 |
pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]); |
|
237 |
//this is just pred_motion() but with the cases removed that cannot happen for direct blocks |
|
238 |
const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ]; |
|
239 |
const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ]; |
|
240 |
|
|
241 |
int match_count= (left_ref==ref[list]) + (top_ref==ref[list]) + (refc==ref[list]); |
|
242 |
if(match_count > 1){ //most common |
|
243 |
mv[list][0]= mid_pred(A[0], B[0], C[0]); |
|
244 |
mv[list][1]= mid_pred(A[1], B[1], C[1]); |
|
245 |
}else { |
|
246 |
assert(match_count==1); |
|
247 |
if(left_ref==ref[list]){ |
|
248 |
mv[list][0]= A[0]; |
|
249 |
mv[list][1]= A[1]; |
|
250 |
}else if(top_ref==ref[list]){ |
|
251 |
mv[list][0]= B[0]; |
|
252 |
mv[list][1]= B[1]; |
|
253 |
}else{ |
|
254 |
mv[list][0]= C[0]; |
|
255 |
mv[list][1]= C[1]; |
|
256 |
} |
|
257 |
} |
|
236 | 258 |
}else{ |
237 | 259 |
int mask= ~(MB_TYPE_L0 << (2*list)); |
238 | 260 |
mv[list][0] = mv[list][1] = 0; |
Also available in: Unified diff