Mercurial > libavcodec.hg
comparison h264_cabac.c @ 11184:cc70f8c44019 libavcodec
Drop compute_mb_neighbors() and move fill_decode_neighbors() up to take its
role.
Should be faster as this is a strict code removial.
author | michael |
---|---|
date | Mon, 15 Feb 2010 23:04:07 +0000 |
parents | d1a855cb0a0c |
children | 6011626999a1 |
comparison
equal
deleted
inserted
replaced
11183:d1a855cb0a0c | 11184:cc70f8c44019 |
---|---|
1180 if( cat == 0 || cat == 3 ) decode_cabac_residual_dc(h, block, cat, n, scantable, qmul, max_coeff); | 1180 if( cat == 0 || cat == 3 ) decode_cabac_residual_dc(h, block, cat, n, scantable, qmul, max_coeff); |
1181 else decode_cabac_residual_nondc(h, block, cat, n, scantable, qmul, max_coeff); | 1181 else decode_cabac_residual_nondc(h, block, cat, n, scantable, qmul, max_coeff); |
1182 #endif | 1182 #endif |
1183 } | 1183 } |
1184 | 1184 |
1185 static inline void compute_mb_neighbors(H264Context *h) | |
1186 { | |
1187 MpegEncContext * const s = &h->s; | |
1188 const int mb_xy = h->mb_xy; | |
1189 h->top_mb_xy = mb_xy - s->mb_stride; | |
1190 h->left_mb_xy[0] = mb_xy - 1; | |
1191 if(FRAME_MBAFF){ | |
1192 const int pair_xy = s->mb_x + (s->mb_y & ~1)*s->mb_stride; | |
1193 const int top_pair_xy = pair_xy - s->mb_stride; | |
1194 const int top_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]); | |
1195 const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]); | |
1196 const int curr_mb_field_flag = MB_FIELD; | |
1197 const int bottom = (s->mb_y & 1); | |
1198 | |
1199 if (curr_mb_field_flag && (bottom || top_mb_field_flag)){ | |
1200 h->top_mb_xy -= s->mb_stride; | |
1201 } | |
1202 if (!left_mb_field_flag == curr_mb_field_flag) { | |
1203 h->left_mb_xy[0] = pair_xy - 1; | |
1204 } | |
1205 } else if (FIELD_PICTURE) { | |
1206 h->top_mb_xy -= s->mb_stride; | |
1207 } | |
1208 return; | |
1209 } | |
1210 | |
1211 /** | 1185 /** |
1212 * decodes a macroblock | 1186 * decodes a macroblock |
1213 * @returns 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed | 1187 * @returns 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed |
1214 */ | 1188 */ |
1215 int ff_h264_decode_mb_cabac(H264Context *h) { | 1189 int ff_h264_decode_mb_cabac(H264Context *h) { |
1255 h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); | 1229 h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); |
1256 } | 1230 } |
1257 | 1231 |
1258 h->prev_mb_skipped = 0; | 1232 h->prev_mb_skipped = 0; |
1259 | 1233 |
1260 compute_mb_neighbors(h); | 1234 fill_decode_neighbors(h, -(MB_FIELD)); |
1261 | 1235 |
1262 if( h->slice_type_nos == FF_B_TYPE ) { | 1236 if( h->slice_type_nos == FF_B_TYPE ) { |
1263 const int mba_xy = h->left_mb_xy[0]; | 1237 const int mba_xy = h->left_mb_xy[0]; |
1264 const int mbb_xy = h->top_mb_xy; | 1238 const int mbb_xy = h->top_mb_xy; |
1265 int ctx = 0; | 1239 int ctx = 0; |
1363 if(MB_MBAFF){ | 1337 if(MB_MBAFF){ |
1364 h->ref_count[0] <<= 1; | 1338 h->ref_count[0] <<= 1; |
1365 h->ref_count[1] <<= 1; | 1339 h->ref_count[1] <<= 1; |
1366 } | 1340 } |
1367 | 1341 |
1368 fill_decode_neighbors(h, mb_type); | |
1369 fill_decode_caches(h, mb_type); | 1342 fill_decode_caches(h, mb_type); |
1370 | 1343 |
1371 if( IS_INTRA( mb_type ) ) { | 1344 if( IS_INTRA( mb_type ) ) { |
1372 int i, pred_mode; | 1345 int i, pred_mode; |
1373 if( IS_INTRA4x4( mb_type ) ) { | 1346 if( IS_INTRA4x4( mb_type ) ) { |