Revision 4ae3ee4a

View differences:

Makefile
66 66

  
67 67
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
68 68
               ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
69
               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
69
               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS
70 70

  
71 71
define RESET
72 72
$(1) :=
libavcodec/arm/Makefile
3 3
OBJS-$(CONFIG_VP5_DECODER)             += arm/vp56dsp_init_arm.o
4 4
OBJS-$(CONFIG_VP6_DECODER)             += arm/vp56dsp_init_arm.o
5 5
OBJS-$(CONFIG_VP8_DECODER)             += arm/vp8dsp_init_arm.o
6
ARMV6-OBJS-$(CONFIG_VP8_DECODER)       += arm/vp8_armv6.o
6 7

  
7 8
OBJS-$(CONFIG_H264DSP)                 += arm/h264dsp_init_arm.o
8 9
OBJS-$(CONFIG_H264PRED)                += arm/h264pred_init_arm.o
......
23 24
OBJS-$(HAVE_ARMV6)                     += arm/dsputil_init_armv6.o      \
24 25
                                          arm/dsputil_armv6.o           \
25 26
                                          arm/simple_idct_armv6.o       \
27
                                          $(ARMV6-OBJS-yes)
26 28

  
27 29
VFP-OBJS-$(HAVE_ARMV6)                 += arm/fmtconvert_vfp.o          \
28 30

  
libavcodec/arm/vp8.h
1
/**
2
 * This file is part of FFmpeg.
3
 *
4
 * FFmpeg is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8
 *
9
 * FFmpeg is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with FFmpeg; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
 */
18

  
19
#ifndef AVCODEC_ARM_VP8_H
20
#define AVCODEC_ARM_VP8_H
21

  
22
#if HAVE_ARMV6
23
#define decode_block_coeffs_internal ff_decode_block_coeffs_armv6
24
int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16],
25
                                 uint8_t probs[8][3][NUM_DCT_TOKENS-1],
26
                                 int i, uint8_t *token_prob, int16_t qmul[2]);
27
#endif
28

  
29
#endif
libavcodec/arm/vp8_armv6.S
1
/**
2
 * Copyright (C) 2010 Mans Rullgard
3
 *
4
 * This file is part of FFmpeg.
5
 *
6
 * FFmpeg is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * FFmpeg is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with FFmpeg; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
 */
20

  
21
#include "asm.S"
22

  
23
        .syntax         unified
24

  
25
.macro rac_get_prob     h, bs, buf, cw, pr, t0, t1
26
        adds            \bs, \bs, \t0
27
        lsl             \cw, \cw, \t0
28
        lsl             \t0, \h,  \t0
29
        rsb             \h,  \pr, #256
30
        ldrhcs          \t1, [\buf], #2
31
        smlabb          \h,  \t0, \pr, \h
32
        rev16cs         \t1, \t1
33
        orrcs           \cw, \cw, \t1, lsl \bs
34
        subcs           \bs, \bs, #16
35
        lsr             \h,  \h,  #8
36
        cmp             \cw, \h,  lsl #16
37
        subge           \cw, \cw, \h,  lsl #16
38
        subge           \h,  \t0, \h
39
.endm
40

  
41
.macro rac_get_128      h, bs, buf, cw, t0, t1
42
        adds            \bs, \bs, \t0
43
        lsl             \cw, \cw, \t0
44
        lsl             \t0, \h,  \t0
45
        ldrhcs          \t1, [\buf], #2
46
        mov             \h,  #128
47
        rev16cs         \t1, \t1
48
        add             \h,  \h,  \t0, lsl #7
49
        orrcs           \cw, \cw, \t1, lsl \bs
50
        subcs           \bs, \bs, #16
51
        lsr             \h,  \h,  #8
52
        cmp             \cw, \h,  lsl #16
53
        subge           \cw, \cw, \h,  lsl #16
54
        subge           \h,  \t0, \h
55
.endm
56

  
57
function ff_decode_block_coeffs_armv6, export=1
58
        push            {r0,r1,r4-r11,lr}
59
        movrel          lr,  ff_vp56_norm_shift
60
        ldrd            r4,  r5,  [sp, #44]             @ token_prob, qmul
61
        cmp             r3,  #0
62
        ldr             r11, [r5]
63
        ldm             r0,  {r5-r7}                    @ high, bits, buf
64
        pkhtbne         r11, r11, r11, asr #16
65
        ldr             r8,  [r0, #16]                  @ code_word
66
0:
67
        ldrb            r9,  [lr, r5]
68
        add             r3,  r3,  #1
69
        ldrb            r0,  [r4, #1]
70
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
71
        blt             2f
72

  
73
        ldrb            r9,  [lr, r5]
74
        ldrb            r0,  [r4, #2]
75
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
76
        ldrb            r9,  [lr, r5]
77
        bge             3f
78

  
79
        add             r4,  r3,  r3,  lsl #5
80
        sxth            r12, r11
81
        add             r4,  r2,  r4
82
        adds            r6,  r6,  r9
83
        add             r4,  r4,  #11
84
        lsl             r8,  r8,  r9
85
        ldrhcs          r10, [r7], #2
86
        lsl             r9,  r5,  r9
87
        mov             r5,  #128
88
        rev16cs         r10, r10
89
        add             r5,  r5,  r9,  lsl #7
90
        orrcs           r8,  r8,  r10, lsl r6
91
        subcs           r6,  r6,  #16
92
        lsr             r5,  r5,  #8
93
        cmp             r8,  r5,  lsl #16
94
        movrel          r10, zigzag_scan-1
95
        subge           r8,  r8,  r5,  lsl #16
96
        subge           r5,  r9,  r5
97
        ldrb            r10, [r10, r3]
98
        rsbge           r12, r12, #0
99
        cmp             r3,  #16
100
        strh            r12, [r1, r10]
101
        bge             6f
102
5:
103
        ldrb            r9,  [lr, r5]
104
        ldrb            r0,  [r4]
105
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
106
        pkhtb           r11, r11, r11, asr #16
107
        bge             0b
108

  
109
6:
110
        ldr             r0,  [sp]
111
        ldr             r9,  [r0, #12]
112
        cmp             r7,  r9
113
        movhi           r7,  r9
114
        stm             r0,  {r5-r7}                    @ high, bits, buf
115
        str             r8,  [r0, #16]                  @ code_word
116

  
117
        add             sp,  sp,  #8
118
        mov             r0,  r3
119
        pop             {r4-r11,pc}
120
2:
121
        add             r4,  r3,  r3,  lsl #5
122
        cmp             r3,  #16
123
        add             r4,  r2,  r4
124
        pkhtb           r11, r11, r11, asr #16
125
        bne             0b
126
        b               6b
127
3:
128
        ldrb            r0,  [r4, #3]
129
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
130
        ldrb            r9,  [lr, r5]
131
        bge             1f
132

  
133
        mov             r12, #2
134
        ldrb            r0,  [r4, #4]
135
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
136
        addge           r12, #1
137
        ldrb            r9,  [lr, r5]
138
        blt             4f
139
        ldrb            r0,  [r4, #5]
140
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
141
        addge           r12, #1
142
        ldrb            r9,  [lr, r5]
143
        b               4f
144
1:
145
        ldrb            r0,  [r4, #6]
146
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
147
        ldrb            r9,  [lr, r5]
148
        bge             3f
149

  
150
        ldrb            r0,  [r4, #7]
151
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
152
        ldrb            r9,  [lr, r5]
153
        bge             2f
154

  
155
        mov             r12, #5
156
        mov             r0,  #159
157
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
158
        addge           r12, r12, #1
159
        ldrb            r9,  [lr, r5]
160
        b               4f
161
2:
162
        mov             r12, #7
163
        mov             r0,  #165
164
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
165
        addge           r12, r12, #2
166
        ldrb            r9,  [lr, r5]
167
        mov             r0,  #145
168
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
169
        addge           r12, r12, #1
170
        ldrb            r9,  [lr, r5]
171
        b               4f
172
3:
173
        ldrb            r0,  [r4, #8]
174
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
175
        addge           r4,  r4,  #1
176
        ldrb            r9,  [lr, r5]
177
        movge           r12, #2
178
        movlt           r12, #0
179
        ldrb            r0,  [r4, #9]
180
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
181
        mov             r9,  #8
182
        addge           r12, r12, #1
183
        movrel          r4,  ff_vp8_dct_cat_prob
184
        lsl             r9,  r9,  r12
185
        ldr             r4,  [r4, r12, lsl #2]
186
        add             r12, r9,  #3
187
        mov             r1,  #0
188
        ldrb            r0,  [r4], #1
189
1:
190
        ldrb            r9,  [lr, r5]
191
        lsl             r1,  r1,  #1
192
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
193
        ldrb            r0,  [r4], #1
194
        addge           r1,  r1,  #1
195
        cmp             r0,  #0
196
        bne             1b
197
        ldrb            r9,  [lr, r5]
198
        add             r12, r12, r1
199
        ldr             r1,  [sp, #4]
200
4:
201
        add             r4,  r3,  r3,  lsl #5
202
        add             r4,  r2,  r4
203
        add             r4,  r4,  #22
204
        rac_get_128     r5,  r6,  r7,  r8,  r9,  r10
205
        rsbge           r12, r12, #0
206
        smulbb          r12, r12, r11
207
        movrel          r9,  zigzag_scan-1
208
        ldrb            r9,  [r9, r3]
209
        cmp             r3,  #16
210
        strh            r12, [r1, r9]
211
        bge             6b
212
        b               5b
213
endfunc
214

  
215
        .section        .rodata
216
zigzag_scan:
217
        .byte            0,  2,  8, 16
218
        .byte           10,  4,  6, 12
219
        .byte           18, 24, 26, 20
220
        .byte           14, 22, 28, 30
libavcodec/vp8.c
30 30
#include "h264pred.h"
31 31
#include "rectangle.h"
32 32

  
33
#if ARCH_ARM
34
#   include "arm/vp8.h"
35
#endif
36

  
33 37
typedef struct {
34 38
    uint8_t filter_level;
35 39
    uint8_t inner_limit;
......
801 805
    }
802 806
}
803 807

  
808
#ifndef decode_block_coeffs_internal
804 809
/**
805 810
 * @param c arithmetic bitstream reader context
806 811
 * @param block destination for block coefficients
......
854 859
                    int b = vp56_rac_get_prob(c, token_prob[9+a]);
855 860
                    int cat = (a<<1) + b;
856 861
                    coeff  = 3 + (8<<cat);
857
                    coeff += vp8_rac_get_coeff(c, vp8_dct_cat_prob[cat]);
862
                    coeff += vp8_rac_get_coeff(c, ff_vp8_dct_cat_prob[cat]);
858 863
                }
859 864
            }
860 865
            token_prob = probs[i+1][2];
......
864 869

  
865 870
    return i;
866 871
}
872
#endif
867 873

  
868 874
static av_always_inline
869 875
int decode_block_coeffs(VP56RangeCoder *c, DCTELEM block[16],
libavcodec/vp8data.h
313 313
static const uint8_t vp8_dct_cat6_prob[] = { 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129, 0 };
314 314

  
315 315
// only used for cat3 and above; cat 1 and 2 are referenced directly
316
static const uint8_t * const vp8_dct_cat_prob[] =
316
const uint8_t * const ff_vp8_dct_cat_prob[] =
317 317
{
318 318
    vp8_dct_cat3_prob,
319 319
    vp8_dct_cat4_prob,

Also available in: Unified diff