Mercurial > libavcodec.hg
comparison h264_mvpred.h @ 11292:411ab09ada91 libavcodec
Get rid of mb2b8_xy and b8_stride, change arrays organized based on b8_stride to
ones based on mb_stride in h264.
about 20 cpu cycles faster overall per MB
author | michael |
---|---|
date | Thu, 25 Feb 2010 23:44:42 +0000 |
parents | 10c06a9bd3d9 |
children | fd2f27fcb749 |
comparison
equal
deleted
inserted
replaced
11291:1527e25ec9d4 | 11292:411ab09ada91 |
---|---|
41 | 41 |
42 /* there is no consistent mapping of mvs to neighboring locations that will | 42 /* there is no consistent mapping of mvs to neighboring locations that will |
43 * make mbaff happy, so we can't move all this logic to fill_caches */ | 43 * make mbaff happy, so we can't move all this logic to fill_caches */ |
44 if(FRAME_MBAFF){ | 44 if(FRAME_MBAFF){ |
45 | 45 |
46 #define SET_DIAG_MV(MV_OP, REF_OP, X4, Y4)\ | 46 #define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4)\ |
47 const int x4 = X4, y4 = Y4;\ | 47 const int xy = XY, y4 = Y4;\ |
48 const int mb_type = mb_types[(x4>>2)+(y4>>2)*s->mb_stride];\ | 48 const int mb_type = mb_types[xy+(y4>>2)*s->mb_stride];\ |
49 if(!USES_LIST(mb_type,list))\ | 49 if(!USES_LIST(mb_type,list))\ |
50 return LIST_NOT_USED;\ | 50 return LIST_NOT_USED;\ |
51 mv = s->current_picture_ptr->motion_val[list][x4 + y4*h->b_stride];\ | 51 mv = s->current_picture_ptr->motion_val[list][h->mb2b_xy[xy]+3 + y4*h->b_stride];\ |
52 h->mv_cache[list][scan8[0]-2][0] = mv[0];\ | 52 h->mv_cache[list][scan8[0]-2][0] = mv[0];\ |
53 h->mv_cache[list][scan8[0]-2][1] = mv[1] MV_OP;\ | 53 h->mv_cache[list][scan8[0]-2][1] = mv[1] MV_OP;\ |
54 return s->current_picture_ptr->ref_index[list][(x4>>1) + (y4>>1)*h->b8_stride] REF_OP; | 54 return s->current_picture_ptr->ref_index[list][4*xy+1 + (y4&~1)] REF_OP; |
55 | 55 |
56 if(topright_ref == PART_NOT_AVAILABLE | 56 if(topright_ref == PART_NOT_AVAILABLE |
57 && i >= scan8[0]+8 && (i&7)==4 | 57 && i >= scan8[0]+8 && (i&7)==4 |
58 && h->ref_cache[list][scan8[0]-1] != PART_NOT_AVAILABLE){ | 58 && h->ref_cache[list][scan8[0]-1] != PART_NOT_AVAILABLE){ |
59 const uint32_t *mb_types = s->current_picture_ptr->mb_type; | 59 const uint32_t *mb_types = s->current_picture_ptr->mb_type; |
61 AV_ZERO32(h->mv_cache[list][scan8[0]-2]); | 61 AV_ZERO32(h->mv_cache[list][scan8[0]-2]); |
62 *C = h->mv_cache[list][scan8[0]-2]; | 62 *C = h->mv_cache[list][scan8[0]-2]; |
63 | 63 |
64 if(!MB_FIELD | 64 if(!MB_FIELD |
65 && IS_INTERLACED(mb_types[h->left_mb_xy[0]])){ | 65 && IS_INTERLACED(mb_types[h->left_mb_xy[0]])){ |
66 SET_DIAG_MV(*2, >>1, s->mb_x*4-1, (s->mb_y|1)*4+(s->mb_y&1)*2+(i>>4)-1); | 66 SET_DIAG_MV(*2, >>1, h->left_mb_xy[0]+s->mb_stride, (s->mb_y&1)*2+(i>>4)-1); |
67 assert(h->left_mb_xy[0] == h->left_mb_xy[1]); | |
67 } | 68 } |
68 if(MB_FIELD | 69 if(MB_FIELD |
69 && !IS_INTERLACED(mb_types[h->left_mb_xy[0]])){ | 70 && !IS_INTERLACED(mb_types[h->left_mb_xy[0]])){ |
70 // left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK. | 71 // left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK. |
71 SET_DIAG_MV(/2, <<1, s->mb_x*4-1, (s->mb_y&~1)*4 - 1 + ((i-scan8[0])>>3)*2); | 72 SET_DIAG_MV(/2, <<1, h->left_mb_xy[i>=36], (- 1 + ((i-scan8[0])>>3)*2)&3); |
72 } | 73 } |
73 } | 74 } |
74 #undef SET_DIAG_MV | 75 #undef SET_DIAG_MV |
75 } | 76 } |
76 | 77 |