Revision f311208c

View differences:

libavcodec/vp8.c
868 868
    int i, x, y, luma_start = 0, luma_ctx = 3;
869 869
    int nnz_pred, nnz, nnz_total = 0;
870 870
    int segment = s->segment;
871
    int block_dc = 0;
871 872

  
872 873
    if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) {
873 874
        nnz_pred = t_nnz[8] + l_nnz[8];
......
876 877
        nnz = decode_block_coeffs(c, s->block_dc, s->prob->token[1], 0, nnz_pred,
877 878
                                  s->qmat[segment].luma_dc_qmul);
878 879
        l_nnz[8] = t_nnz[8] = !!nnz;
879
        nnz_total += nnz;
880
        s->vp8dsp.vp8_luma_dc_wht(s->block, s->block_dc);
880
        if (nnz) {
881
            nnz_total += nnz;
882
            block_dc = 1;
883
            if (nnz == 1)
884
                s->vp8dsp.vp8_luma_dc_wht_dc(s->block, s->block_dc);
885
            else
886
                s->vp8dsp.vp8_luma_dc_wht(s->block, s->block_dc);
887
        }
881 888
        luma_start = 1;
882 889
        luma_ctx = 0;
883 890
    }
......
888 895
            nnz_pred = l_nnz[y] + t_nnz[x];
889 896
            nnz = decode_block_coeffs(c, s->block[y][x], s->prob->token[luma_ctx], luma_start,
890 897
                                      nnz_pred, s->qmat[segment].luma_qmul);
891
            // nnz+luma_start may be one more than the actual last index, but we don't care
892
            s->non_zero_count_cache[y][x] = nnz + luma_start;
898
            // nnz+block_dc may be one more than the actual last index, but we don't care
899
            s->non_zero_count_cache[y][x] = nnz + block_dc;
893 900
            t_nnz[x] = l_nnz[y] = !!nnz;
894 901
            nnz_total += nnz;
895 902
        }
libavcodec/vp8dsp.c
51 51
        dc[i*4+2] = 0;
52 52
        dc[i*4+3] = 0;
53 53

  
54
        *block[i][0] = (t0 + t1) >> 3;
55
        *block[i][1] = (t3 + t2) >> 3;
56
        *block[i][2] = (t0 - t1) >> 3;
57
        *block[i][3] = (t3 - t2) >> 3;
54
        block[i][0][0] = (t0 + t1) >> 3;
55
        block[i][1][0] = (t3 + t2) >> 3;
56
        block[i][2][0] = (t0 - t1) >> 3;
57
        block[i][3][0] = (t3 - t2) >> 3;
58 58
    }
59 59
}
60 60

  
61
static void vp8_luma_dc_wht_dc_c(DCTELEM block[4][4][16], DCTELEM dc[16])
62
{
63
    int i, val = (dc[0] + 3) >> 3;
64
    dc[0] = 0;
65

  
66
    for (i = 0; i < 4; i++) {
67
        block[i][0][0] = val;
68
        block[i][1][0] = val;
69
        block[i][2][0] = val;
70
        block[i][3][0] = val;
71
    }
72
}
61 73

  
62 74
#define MUL_20091(a) ((((a)*20091) >> 16) + (a))
63 75
#define MUL_35468(a)  (((a)*35468) >> 16)
......
480 492
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
481 493
{
482 494
    dsp->vp8_luma_dc_wht    = vp8_luma_dc_wht_c;
495
    dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
483 496
    dsp->vp8_idct_add       = vp8_idct_add_c;
484 497
    dsp->vp8_idct_dc_add    = vp8_idct_dc_add_c;
485 498
    dsp->vp8_idct_dc_add4y  = vp8_idct_dc_add4y_c;
libavcodec/vp8dsp.h
31 31

  
32 32
typedef struct VP8DSPContext {
33 33
    void (*vp8_luma_dc_wht)(DCTELEM block[4][4][16], DCTELEM dc[16]);
34
    void (*vp8_luma_dc_wht_dc)(DCTELEM block[4][4][16], DCTELEM dc[16]);
34 35
    void (*vp8_idct_add)(uint8_t *dst, DCTELEM block[16], int stride);
35 36
    void (*vp8_idct_dc_add)(uint8_t *dst, DCTELEM block[16], int stride);
36 37
    void (*vp8_idct_dc_add4y)(uint8_t *dst, DCTELEM block[4][16], int stride);

Also available in: Unified diff