Revision 3ae079a3

View differences:

libavcodec/vp8.c
1206 1206
                        }
1207 1207
                    }
1208 1208
                } else {
1209
                    s->vp8dsp.vp8_idct_dc_add4(y_dst, s->block[y], s->linesize);
1209
                    s->vp8dsp.vp8_idct_dc_add4y(y_dst, s->block[y], s->linesize);
1210 1210
                }
1211 1211
            }
1212 1212
            y_dst += 4*s->linesize;
......
1214 1214
    }
1215 1215

  
1216 1216
    for (ch = 0; ch < 2; ch++) {
1217
        if (AV_RN32A(s->non_zero_count_cache[4+ch])) {
1217
        uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[4+ch]);
1218
        if (nnz4) {
1218 1219
            uint8_t *ch_dst = dst[1+ch];
1219
            for (y = 0; y < 2; y++) {
1220
                for (x = 0; x < 2; x++) {
1221
                    int nnz = s->non_zero_count_cache[4+ch][(y<<1)+x];
1222
                    if (nnz) {
1223
                        if (nnz == 1)
1224
                            s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1225
                        else
1226
                            s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1220
            if (nnz4&~0x01010101) {
1221
                for (y = 0; y < 2; y++) {
1222
                    for (x = 0; x < 2; x++) {
1223
                        int nnz = s->non_zero_count_cache[4+ch][(y<<1)+x];
1224
                        if (nnz) {
1225
                            if (nnz == 1)
1226
                                s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1227
                            else
1228
                                s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1229
                        }
1227 1230
                    }
1231
                    ch_dst += 4*s->uvlinesize;
1228 1232
                }
1229
                ch_dst += 4*s->uvlinesize;
1233
            } else {
1234
                s->vp8dsp.vp8_idct_dc_add4uv(ch_dst, s->block[4+ch], s->uvlinesize);
1230 1235
            }
1231 1236
        }
1232 1237
    }
libavcodec/vp8dsp.c
109 109
    }
110 110
}
111 111

  
112
static void vp8_idct_dc_add4_c(uint8_t *dst, DCTELEM block[4][16], int stride)
112
static void vp8_idct_dc_add4uv_c(uint8_t *dst, DCTELEM block[4][16], int stride)
113 113
{
114
    int i, j;
115
    for (j = 0; j < 4; j++) {
116
        uint8_t *pix = dst+j*4;
117
        int dc = (block[j][0] + 4) >> 3;
118
        uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + dc;
119
        block[j][0] = 0;
120
        if (!dc)
121
            continue;
122
        for (i = 0; i < 4; i++) {
123
            pix[0] = cm[pix[0]];
124
            pix[1] = cm[pix[1]];
125
            pix[2] = cm[pix[2]];
126
            pix[3] = cm[pix[3]];
127
            pix += stride;
128
        }
129
    }
114
    vp8_idct_dc_add_c(dst+stride*0+0, block[0], stride);
115
    vp8_idct_dc_add_c(dst+stride*0+4, block[1], stride);
116
    vp8_idct_dc_add_c(dst+stride*4+0, block[2], stride);
117
    vp8_idct_dc_add_c(dst+stride*4+4, block[3], stride);
118
}
119

  
120
static void vp8_idct_dc_add4y_c(uint8_t *dst, DCTELEM block[4][16], int stride)
121
{
122
    vp8_idct_dc_add_c(dst+ 0, block[0], stride);
123
    vp8_idct_dc_add_c(dst+ 4, block[1], stride);
124
    vp8_idct_dc_add_c(dst+ 8, block[2], stride);
125
    vp8_idct_dc_add_c(dst+12, block[3], stride);
130 126
}
131 127

  
132 128
// because I like only having two parameters to pass functions...
......
479 475

  
480 476
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
481 477
{
482
    dsp->vp8_luma_dc_wht  = vp8_luma_dc_wht_c;
483
    dsp->vp8_idct_add     = vp8_idct_add_c;
484
    dsp->vp8_idct_dc_add  = vp8_idct_dc_add_c;
485
    dsp->vp8_idct_dc_add4 = vp8_idct_dc_add4_c;
478
    dsp->vp8_luma_dc_wht    = vp8_luma_dc_wht_c;
479
    dsp->vp8_idct_add       = vp8_idct_add_c;
480
    dsp->vp8_idct_dc_add    = vp8_idct_dc_add_c;
481
    dsp->vp8_idct_dc_add4y  = vp8_idct_dc_add4y_c;
482
    dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
486 483

  
487 484
    dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
488 485
    dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
libavcodec/vp8dsp.h
33 33
    void (*vp8_luma_dc_wht)(DCTELEM block[4][4][16], DCTELEM dc[16]);
34 34
    void (*vp8_idct_add)(uint8_t *dst, DCTELEM block[16], int stride);
35 35
    void (*vp8_idct_dc_add)(uint8_t *dst, DCTELEM block[16], int stride);
36
    void (*vp8_idct_dc_add4)(uint8_t *dst, DCTELEM block[4][16], int stride);
36
    void (*vp8_idct_dc_add4y)(uint8_t *dst, DCTELEM block[4][16], int stride);
37
    void (*vp8_idct_dc_add4uv)(uint8_t *dst, DCTELEM block[4][16], int stride);
37 38

  
38 39
    // loop filter applied to edges between macroblocks
39 40
    void (*vp8_v_loop_filter16y)(uint8_t *dst, int stride,
libavcodec/x86/vp8dsp-init.c
220 220

  
221 221
extern void ff_vp8_idct_dc_add_mmx(uint8_t *dst, DCTELEM block[16], int stride);
222 222
extern void ff_vp8_idct_dc_add_sse4(uint8_t *dst, DCTELEM block[16], int stride);
223
extern void ff_vp8_idct_dc_add4_mmx(uint8_t *dst, DCTELEM block[4][16], int stride);
224
extern void ff_vp8_idct_dc_add4_sse2(uint8_t *dst, DCTELEM block[4][16], int stride);
223
extern void ff_vp8_idct_dc_add4y_mmx(uint8_t *dst, DCTELEM block[4][16], int stride);
224
extern void ff_vp8_idct_dc_add4y_sse2(uint8_t *dst, DCTELEM block[4][16], int stride);
225
extern void ff_vp8_idct_dc_add4uv_mmx(uint8_t *dst, DCTELEM block[2][16], int stride);
225 226
extern void ff_vp8_luma_dc_wht_mmx(DCTELEM block[4][4][16], DCTELEM dc[16]);
226 227
extern void ff_vp8_idct_add_mmx(uint8_t *dst, DCTELEM block[16], int stride);
227 228
extern void ff_vp8_idct_add_sse(uint8_t *dst, DCTELEM block[16], int stride);
......
284 285

  
285 286
#if HAVE_YASM
286 287
    if (mm_flags & FF_MM_MMX) {
287
        c->vp8_idct_dc_add                  = ff_vp8_idct_dc_add_mmx;
288
        c->vp8_idct_dc_add4                 = ff_vp8_idct_dc_add4_mmx;
289
        c->vp8_idct_add                     = ff_vp8_idct_add_mmx;
290
        c->vp8_luma_dc_wht                  = ff_vp8_luma_dc_wht_mmx;
288
        c->vp8_idct_dc_add    = ff_vp8_idct_dc_add_mmx;
289
        c->vp8_idct_dc_add4y  = ff_vp8_idct_dc_add4y_mmx;
290
        c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
291
        c->vp8_idct_add       = ff_vp8_idct_add_mmx;
292
        c->vp8_luma_dc_wht    = ff_vp8_luma_dc_wht_mmx;
291 293
        c->put_vp8_epel_pixels_tab[0][0][0]     =
292 294
        c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx;
293 295
        c->put_vp8_epel_pixels_tab[1][0][0]     =
......
354 356
    }
355 357

  
356 358
    if (mm_flags & FF_MM_SSE2) {
357
        c->vp8_idct_dc_add4           = ff_vp8_idct_dc_add4_sse2;
359
        c->vp8_idct_dc_add4y          = ff_vp8_idct_dc_add4y_sse2;
358 360

  
359 361
        c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_sse2;
360 362
        c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_sse2;
libavcodec/x86/vp8dsp.asm
976 976
    RET
977 977

  
978 978
;-----------------------------------------------------------------------------
979
; void vp8_idct_dc_add4_<opt>(uint8_t *dst, DCTELEM block[4][16], int stride);
979
; void vp8_idct_dc_add4y_<opt>(uint8_t *dst, DCTELEM block[4][16], int stride);
980 980
;-----------------------------------------------------------------------------
981 981

  
982 982
INIT_MMX
983
cglobal vp8_idct_dc_add4_mmx, 3, 3
983
cglobal vp8_idct_dc_add4y_mmx, 3, 3
984 984
    ; load data
985 985
    movd      m0, [r1+32*0] ; A
986 986
    movd      m1, [r1+32*2] ; C
......
1015 1015
    RET
1016 1016

  
1017 1017
INIT_XMM
1018
cglobal vp8_idct_dc_add4_sse2, 3, 3
1018
cglobal vp8_idct_dc_add4y_sse2, 3, 3, 6
1019 1019
    ; load data
1020 1020
    movd      m0, [r1+32*0] ; A
1021 1021
    movd      m1, [r1+32*2] ; C
......
1045 1045
    RET
1046 1046

  
1047 1047
;-----------------------------------------------------------------------------
1048
; void vp8_idct_dc_add4uv_<opt>(uint8_t *dst, DCTELEM block[4][16], int stride);
1049
;-----------------------------------------------------------------------------
1050

  
1051
INIT_MMX
1052
cglobal vp8_idct_dc_add4uv_mmx, 3, 3
1053
    ; load data
1054
    movd      m0, [r1+32*0] ; A
1055
    movd      m1, [r1+32*2] ; C
1056
    punpcklwd m0, [r1+32*1] ; A B
1057
    punpcklwd m1, [r1+32*3] ; C D
1058
    punpckldq m0, m1        ; A B C D
1059
    pxor      m6, m6
1060

  
1061
    ; calculate DC
1062
    paddw     m0, [pw_4]
1063
    movd [r1+32*0], m6
1064
    movd [r1+32*1], m6
1065
    movd [r1+32*2], m6
1066
    movd [r1+32*3], m6
1067
    psraw     m0, 3
1068
    psubw     m6, m0
1069
    packuswb  m0, m0
1070
    packuswb  m6, m6
1071
    punpcklbw m0, m0 ; AABBCCDD
1072
    punpcklbw m6, m6 ; AABBCCDD
1073
    movq      m1, m0
1074
    movq      m7, m6
1075
    punpcklbw m0, m0 ; AAAABBBB
1076
    punpckhbw m1, m1 ; CCCCDDDD
1077
    punpcklbw m6, m6 ; AAAABBBB
1078
    punpckhbw m7, m7 ; CCCCDDDD
1079

  
1080
    ; add DC
1081
    lea       r1, [r0+r2*2]
1082
    ADD_DC    m0, m6, 0, mova
1083
    lea       r0, [r0+r2*4]
1084
    lea       r1, [r1+r2*4]
1085
    ADD_DC    m1, m7, 0, mova
1086
    RET
1087

  
1088
;-----------------------------------------------------------------------------
1048 1089
; void vp8_idct_add_<opt>(uint8_t *dst, DCTELEM block[16], int stride);
1049 1090
;-----------------------------------------------------------------------------
1050 1091

  

Also available in: Unified diff