Lines Matching refs:sl
37 static av_always_inline int fetch_diagonal_mv(const H264Context *h, H264SliceContext *sl,
41 const int topright_ref = sl->ref_cache[list][i - 8 + part_width];
52 sl->mv_cache[list][scan8[0] - 2][0] = mv[0]; \
53 sl->mv_cache[list][scan8[0] - 2][1] = mv[1] MV_OP; \
58 && sl->ref_cache[list][scan8[0] - 1] != PART_NOT_AVAILABLE) {
61 AV_ZERO32(sl->mv_cache[list][scan8[0] - 2]);
62 *C = sl->mv_cache[list][scan8[0] - 2];
64 if (!MB_FIELD(sl) && IS_INTERLACED(sl->left_type[0])) {
65 SET_DIAG_MV(* 2, >> 1, sl->left_mb_xy[0] + h->mb_stride,
66 (sl->mb_y & 1) * 2 + (i >> 5));
68 if (MB_FIELD(sl) && !IS_INTERLACED(sl->left_type[0])) {
70 SET_DIAG_MV(/ 2, *2, sl->left_mb_xy[i >= 36], ((i >> 2)) & 3);
77 *C = sl->mv_cache[list][i - 8 + part_width];
82 *C = sl->mv_cache[list][i - 8 - 1];
83 return sl->ref_cache[list][i - 8 - 1];
95 H264SliceContext *sl,
101 const int top_ref = sl->ref_cache[list][index8 - 8];
102 const int left_ref = sl->ref_cache[list][index8 - 1];
103 const int16_t *const A = sl->mv_cache[list][index8 - 1];
104 const int16_t *const B = sl->mv_cache[list][index8 - 8];
118 diagonal_ref = fetch_diagonal_mv(h, sl, &C, index8, list, part_width);
150 A[0], A[1], ref, *mx, *my, sl->mb_x, sl->mb_y, n, list);
160 H264SliceContext *sl,
165 const int top_ref = sl->ref_cache[list][scan8[0] - 8];
166 const int16_t *const B = sl->mv_cache[list][scan8[0] - 8];
169 top_ref, B[0], B[1], sl->mb_x, sl->mb_y, n, list);
177 const int left_ref = sl->ref_cache[list][scan8[8] - 1];
178 const int16_t *const A = sl->mv_cache[list][scan8[8] - 1];
181 left_ref, A[0], A[1], sl->mb_x, sl->mb_y, n, list);
191 pred_motion(h, sl, n, 4, list, ref, mx, my);
201 H264SliceContext *sl,
206 const int left_ref = sl->ref_cache[list][scan8[0] - 1];
207 const int16_t *const A = sl->mv_cache[list][scan8[0] - 1];
210 left_ref, A[0], A[1], sl->mb_x, sl->mb_y, n, list);
221 diagonal_ref = fetch_diagonal_mv(h, sl, &C, scan8[4], list, 2);
224 diagonal_ref, C[0], C[1], sl->mb_x, sl->mb_y, n, list);
234 pred_motion(h, sl, n, 2, list, ref, mx, my);
239 if (MB_FIELD(sl)) { \
257 H264SliceContext *sl)
267 fill_rectangle(&sl->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1);
274 if (USES_LIST(sl->left_type[LTOP], 0)) {
275 left_ref = ref[4 * sl->left_mb_xy[LTOP] + 1 + (sl->left_block[0] & ~1)];
276 A = mv[h->mb2b_xy[sl->left_mb_xy[LTOP]] + 3 + b_stride * sl->left_block[0]];
277 FIX_MV_MBAFF(sl->left_type[LTOP], left_ref, A, 0);
280 } else if (sl->left_type[LTOP]) {
287 if (USES_LIST(sl->top_type, 0)) {
288 top_ref = ref[4 * sl->top_mb_xy + 2];
289 B = mv[h->mb2b_xy[sl->top_mb_xy] + 3 * b_stride];
290 FIX_MV_MBAFF(sl->top_type, top_ref, B, 1);
293 } else if (sl->top_type) {
301 top_ref, left_ref, sl->mb_x, sl->mb_y);
303 if (USES_LIST(sl->topright_type, 0)) {
304 diagonal_ref = ref[4 * sl->topright_mb_xy + 2];
305 C = mv[h->mb2b_xy[sl->topright_mb_xy] + 3 * b_stride];
306 FIX_MV_MBAFF(sl->topright_type, diagonal_ref, C, 2);
307 } else if (sl->topright_type) {
311 if (USES_LIST(sl->topleft_type, 0)) {
312 diagonal_ref = ref[4 * sl->topleft_mb_xy + 1 +
313 (sl->topleft_partition & 2)];
314 C = mv[h->mb2b_xy[sl->topleft_mb_xy] + 3 + b_stride +
315 (sl->topleft_partition & 2 * b_stride)];
316 FIX_MV_MBAFF(sl->topleft_type, diagonal_ref, C, 2);
317 } else if (sl->topleft_type) {
347 fill_rectangle(sl->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx, my), 4);
351 fill_rectangle(sl->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4);
355 static void fill_decode_neighbors(const H264Context *h, H264SliceContext *sl, int mb_type)
357 const int mb_xy = sl->mb_xy;
366 sl->topleft_partition = -1;
368 top_xy = mb_xy - (h->mb_stride << MB_FIELD(sl));
376 sl->left_block = left_block_options[0];
380 if (sl->mb_y & 1) {
385 sl->left_block = left_block_options[3];
390 sl->topleft_partition = 0;
391 sl->left_block = left_block_options[1];
403 sl->left_block = left_block_options[3];
405 sl->left_block = left_block_options[2];
411 sl->topleft_mb_xy = topleft_xy;
412 sl->top_mb_xy = top_xy;
413 sl->topright_mb_xy = topright_xy;
414 sl->left_mb_xy[LTOP] = left_xy[LTOP];
415 sl->left_mb_xy[LBOT] = left_xy[LBOT];
418 sl->topleft_type = h->cur_pic.mb_type[topleft_xy];
419 sl->top_type = h->cur_pic.mb_type[top_xy];
420 sl->topright_type = h->cur_pic.mb_type[topright_xy];
421 sl->left_type[LTOP] = h->cur_pic.mb_type[left_xy[LTOP]];
422 sl->left_type[LBOT] = h->cur_pic.mb_type[left_xy[LBOT]];
425 if (h->slice_table[topleft_xy] != sl->slice_num)
426 sl->topleft_type = 0;
427 if (h->slice_table[top_xy] != sl->slice_num)
428 sl->top_type = 0;
429 if (h->slice_table[left_xy[LTOP]] != sl->slice_num)
430 sl->left_type[LTOP] = sl->left_type[LBOT] = 0;
432 if (h->slice_table[topleft_xy] != sl->slice_num) {
433 sl->topleft_type = 0;
434 if (h->slice_table[top_xy] != sl->slice_num)
435 sl->top_type = 0;
436 if (h->slice_table[left_xy[LTOP]] != sl->slice_num)
437 sl->left_type[LTOP] = sl->left_type[LBOT] = 0;
440 if (h->slice_table[topright_xy] != sl->slice_num)
441 sl->topright_type = 0;
444 static void fill_decode_caches(const H264Context *h, H264SliceContext *sl, int mb_type)
448 const uint8_t *left_block = sl->left_block;
453 topleft_xy = sl->topleft_mb_xy;
454 top_xy = sl->top_mb_xy;
455 topright_xy = sl->topright_mb_xy;
456 left_xy[LTOP] = sl->left_mb_xy[LTOP];
457 left_xy[LBOT] = sl->left_mb_xy[LBOT];
458 topleft_type = sl->topleft_type;
459 top_type = sl->top_type;
460 topright_type = sl->topright_type;
461 left_type[LTOP] = sl->left_type[LTOP];
462 left_type[LBOT] = sl->left_type[LBOT];
467 sl->topleft_samples_available =
468 sl->top_samples_available =
469 sl->left_samples_available = 0xFFFF;
470 sl->topright_samples_available = 0xEEEA;
473 sl->topleft_samples_available = 0xB3FF;
474 sl->top_samples_available = 0x33FF;
475 sl->topright_samples_available = 0x26EA;
480 sl->topleft_samples_available &= 0xDFFF;
481 sl->left_samples_available &= 0x5FFF;
484 sl->topleft_samples_available &= 0xFF5F;
485 sl->left_samples_available &= 0xFF5F;
492 sl->topleft_samples_available &= 0xDF5F;
493 sl->left_samples_available &= 0x5F5F;
498 sl->topleft_samples_available &= 0xDF5F;
499 sl->left_samples_available &= 0x5F5F;
504 sl->topleft_samples_available &= 0x7FFF;
507 sl->topright_samples_available &= 0xFBFF;
511 AV_COPY32(sl->intra4x4_pred_mode_cache + 4 + 8 * 0, sl->intra4x4_pred_mode + h->mb2br_xy[top_xy]);
513 sl->intra4x4_pred_mode_cache[4 + 8 * 0] =
514 sl->intra4x4_pred_mode_cache[5 + 8 * 0] =
515 sl->intra4x4_pred_mode_cache[6 + 8 * 0] =
516 sl->intra4x4_pred_mode_cache[7 + 8 * 0] = 2 - 3 * !(top_type & type_mask);
520 int8_t *mode = sl->intra4x4_pred_mode + h->mb2br_xy[left_xy[LEFT(i)]];
521 sl->intra4x4_pred_mode_cache[3 + 8 * 1 + 2 * 8 * i] = mode[6 - left_block[0 + 2 * i]];
522 sl->intra4x4_pred_mode_cache[3 + 8 * 2 + 2 * 8 * i] = mode[6 - left_block[1 + 2 * i]];
524 sl->intra4x4_pred_mode_cache[3 + 8 * 1 + 2 * 8 * i] =
525 sl->intra4x4_pred_mode_cache[3 + 8 * 2 + 2 * 8 * i] = 2 - 3 * !(left_type[LEFT(i)] & type_mask);
541 nnz_cache = sl->non_zero_count_cache;
591 sl->top_cbp = h->cbp_table[top_xy];
593 sl->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
596 sl->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0) |
600 sl->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
605 if (IS_INTER(mb_type) || (IS_DIRECT(mb_type) && sl->direct_spatial_mv_pred)) {
608 for (list = 0; list < sl->list_count; list++) {
609 int8_t *ref_cache = &sl->ref_cache[list][scan8[0]];
611 int16_t(*mv_cache)[2] = &sl->mv_cache[list][scan8[0]];
615 av_assert2(!(IS_DIRECT(mb_type) && !sl->direct_spatial_mv_pred));
675 (sl->topleft_partition & 2 * b_stride);
676 const int b8_xy = 4 * topleft_xy + 1 + (sl->topleft_partition & 2);
690 uint8_t(*mvd_cache)[2] = &sl->mvd_cache[list][scan8[0]];
691 uint8_t(*mvd)[2] = sl->mvd_table[list];
722 if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
723 uint8_t *direct_cache = &sl->direct_cache[scan8[0]];
769 if (MB_FIELD(sl)) {
772 if (!IS_INTERLACED(mb_type) && sl->ref_cache[list][idx] >= 0) { \
773 sl->ref_cache[list][idx] *= 2; \
774 sl->mv_cache[list][idx][1] /= 2; \
775 sl->mvd_cache[list][idx][1] >>= 1; \
783 if (IS_INTERLACED(mb_type) && sl->ref_cache[list][idx] >= 0) { \
784 sl->ref_cache[list][idx] >>= 1; \
785 sl->mv_cache[list][idx][1] *= 2; \
786 sl->mvd_cache[list][idx][1] <<= 1; \
796 sl->neighbor_transform_size = !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[LTOP]);
802 static void av_unused decode_mb_skip(const H264Context *h, H264SliceContext *sl)
804 const int mb_xy = sl->mb_xy;
809 if (MB_FIELD(sl))
812 if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
815 if (sl->direct_spatial_mv_pred) {
816 fill_decode_neighbors(h, sl, mb_type);
817 fill_decode_caches(h, sl, mb_type); //FIXME check what is needed and what not ...
819 ff_h264_pred_direct_motion(h, sl, &mb_type);
824 fill_decode_neighbors(h, sl, mb_type);
825 pred_pskip_motion(h, sl);
828 write_back_motion(h, sl, mb_type);
830 h->cur_pic.qscale_table[mb_xy] = sl->qscale;
831 h->slice_table[mb_xy] = sl->slice_num;
832 sl->prev_mb_skipped = 1;