Revision ef38842f libavcodec/vp8.c

View differences:

libavcodec/vp8.c
1084 1084

  
1085 1085
/* Fetch pixels for estimated mv 4 macroblocks ahead.
1086 1086
 * Optimized for 64-byte cache lines.  Inspired by ffh264 prefetch_motion. */
1087
static inline void prefetch_motion(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int ref)
1087
static inline void prefetch_motion(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, int mb_xy, int ref)
1088 1088
{
1089
    /* Don't prefetch refs that haven't been used yet this frame. */
1090
    if (s->ref_count[ref-1]) {
1089
    /* Don't prefetch refs that haven't been used very often this frame. */
1090
    if (s->ref_count[ref-1] > (mb_xy >> 5)) {
1091 1091
        int x_off = mb_x << 4, y_off = mb_y << 4;
1092 1092
        int mx = mb->mv.x + x_off + 8;
1093 1093
        int my = mb->mv.y + y_off;
......
1471 1471
        VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2;
1472 1472
        uint8_t *intra4x4 = s->intra4x4_pred_mode + 4*mb_y*s->b4_stride;
1473 1473
        uint8_t *segment_map = s->segmentation_map + mb_y*s->mb_stride;
1474
        int mb_xy = mb_y * s->mb_stride;
1474 1475
        uint8_t *dst[3] = {
1475 1476
            curframe->data[0] + 16*mb_y*s->linesize,
1476 1477
            curframe->data[1] +  8*mb_y*s->uvlinesize,
......
1487 1488
        if (mb_y)
1488 1489
            memset(s->top_border, 129, sizeof(*s->top_border));
1489 1490

  
1490
        for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
1491
        for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
1491 1492
            uint8_t *intra4x4_mb = s->keyframe ? intra4x4 + 4*mb_x : s->intra4x4_pred_mode_mb;
1492 1493
            uint8_t *segment_mb = segment_map+mb_x;
1493 1494

  
......
1497 1498

  
1498 1499
            decode_mb_mode(s, mb, mb_x, mb_y, intra4x4_mb, segment_mb);
1499 1500

  
1500
            prefetch_motion(s, mb, mb_x, mb_y, VP56_FRAME_PREVIOUS);
1501
            prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS);
1501 1502

  
1502 1503
            if (!mb->skip)
1503 1504
                decode_mb_coeffs(s, c, mb, s->top_nnz[mb_x], s->left_nnz);
......
1507 1508
            else
1508 1509
                inter_predict(s, dst, mb, mb_x, mb_y);
1509 1510

  
1510
            prefetch_motion(s, mb, mb_x, mb_y, VP56_FRAME_GOLDEN);
1511
            prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN);
1511 1512

  
1512 1513
            if (!mb->skip) {
1513 1514
                idct_mb(s, dst[0], dst[1], dst[2], mb);
......
1525 1526
            if (s->deblock_filter)
1526 1527
                filter_level_for_mb(s, mb, &s->filter_strength[mb_x]);
1527 1528

  
1528
            prefetch_motion(s, mb, mb_x, mb_y, VP56_FRAME_GOLDEN2);
1529
            prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN2);
1529 1530

  
1530 1531
            dst[0] += 16;
1531 1532
            dst[1] += 8;
1532 1533
            dst[2] += 8;
1533
            mb++;
1534 1534
        }
1535 1535
        if (s->deblock_filter) {
1536 1536
            if (s->filter.simple)

Also available in: Unified diff