comparison h264.h @ 11282:cf41a3e8e14e libavcodec

Keep mvd_table values of only 2 mb rows.
author michael
date Thu, 25 Feb 2010 02:42:25 +0000
parents c12d6c6c027e
children 853e93a50fe5
comparison
equal deleted inserted replaced
11281:11fb96e94573 11282:cf41a3e8e14e
58 /* Compiling in interlaced support reduces the speed 58 /* Compiling in interlaced support reduces the speed
59 * of progressive decoding by about 2%. */ 59 * of progressive decoding by about 2%. */
60 #define ALLOW_INTERLACE 60 #define ALLOW_INTERLACE
61 61
62 #define ALLOW_NOCHROMA 62 #define ALLOW_NOCHROMA
63
64 #define FMO 0
63 65
64 /** 66 /**
65 * The maximum number of slices supported by the decoder. 67 * The maximum number of slices supported by the decoder.
66 * must be a power of 2 68 * must be a power of 2
67 */ 69 */
342 * block_offset[24..47] for field macroblocks 344 * block_offset[24..47] for field macroblocks
343 */ 345 */
344 int block_offset[2*(16+8)]; 346 int block_offset[2*(16+8)];
345 347
346 uint32_t *mb2b_xy; //FIXME are these 4 a good idea? 348 uint32_t *mb2b_xy; //FIXME are these 4 a good idea?
349 uint32_t *mb2br_xy;
347 uint32_t *mb2b8_xy; 350 uint32_t *mb2b8_xy;
348 int b_stride; //FIXME use s->b4_stride 351 int b_stride; //FIXME use s->b4_stride
349 int b8_stride; 352 int b8_stride;
350 353
351 int mb_linesize; ///< may be equal to s->linesize or s->linesize*2, for mbaff 354 int mb_linesize; ///< may be equal to s->linesize or s->linesize*2, for mbaff
1065 AV_ZERO32(h->mv_cache [list][scan8[12]]); 1068 AV_ZERO32(h->mv_cache [list][scan8[12]]);
1066 1069
1067 if( CABAC ) { 1070 if( CABAC ) {
1068 /* XXX beurk, Load mvd */ 1071 /* XXX beurk, Load mvd */
1069 if(USES_LIST(top_type, list)){ 1072 if(USES_LIST(top_type, list)){
1070 const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; 1073 const int b_xy= h->mb2br_xy[top_xy] + 3*h->b_stride;
1071 AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]); 1074 AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]);
1072 }else{ 1075 }else{
1073 AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]); 1076 AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]);
1074 } 1077 }
1075 if(USES_LIST(left_type[0], list)){ 1078 if(USES_LIST(left_type[0], list)){
1076 const int b_xy= h->mb2b_xy[left_xy[0]] + 3; 1079 const int b_xy= h->mb2br_xy[left_xy[0]] + 3;
1077 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy + h->b_stride*left_block[0]]); 1080 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy + h->b_stride*left_block[0]]);
1078 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy + h->b_stride*left_block[1]]); 1081 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy + h->b_stride*left_block[1]]);
1079 }else{ 1082 }else{
1080 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]); 1083 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]);
1081 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]); 1084 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]);
1082 } 1085 }
1083 if(USES_LIST(left_type[1], list)){ 1086 if(USES_LIST(left_type[1], list)){
1084 const int b_xy= h->mb2b_xy[left_xy[1]] + 3; 1087 const int b_xy= h->mb2br_xy[left_xy[1]] + 3;
1085 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy + h->b_stride*left_block[2]]); 1088 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy + h->b_stride*left_block[2]]);
1086 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy + h->b_stride*left_block[3]]); 1089 AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy + h->b_stride*left_block[3]]);
1087 }else{ 1090 }else{
1088 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]); 1091 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]);
1089 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]); 1092 AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]);
1419 mv_src = &h->mv_cache[list][scan8[0]]; 1422 mv_src = &h->mv_cache[list][scan8[0]];
1420 for(y=0; y<4; y++){ 1423 for(y=0; y<4; y++){
1421 AV_COPY128(mv_dst + y*b_stride, mv_src + 8*y); 1424 AV_COPY128(mv_dst + y*b_stride, mv_src + 8*y);
1422 } 1425 }
1423 if( CABAC ) { 1426 if( CABAC ) {
1424 uint8_t (*mvd_dst)[2] = &h->mvd_table[list][b_xy]; 1427 uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? b_xy : h->mb2br_xy[h->mb_xy]];
1425 uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]]; 1428 uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
1426 if(IS_SKIP(mb_type)) 1429 if(IS_SKIP(mb_type))
1427 fill_rectangle(mvd_dst, 4, 4, h->b_stride, 0, 2); 1430 fill_rectangle(mvd_dst, 4, 4, h->b_stride, 0, 2);
1428 else 1431 else
1429 for(y=0; y<4; y++){ 1432 for(y=0; y<4; y++){