2 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
4 ; Use of this source code is governed by a BSD-style license and patent
5 ; grant that can be found in the LICENSE file in the root of the source
6 ; tree. All contributing project authors may be found in the AUTHORS
7 ; file in the root of the source tree.
11 EXPORT |vp8_decode_mb_tokens_v5|
13 AREA |.text|
, CODE
, READONLY
; name this block of code
15 INCLUDE vpx_asm_offsets.asm
29 ;; constant offsets -- these should be created at build time
30 c_onyxblock2left_offset
EQU 25
31 c_onyxblock2above_offset
EQU 50
32 c_entropy_nodes
EQU 11
33 c_dct_eob_token
EQU 11
35 |vp8_decode_mb_tokens_v5|
PROC
36 stmdb
sp!, {r4 - r11, lr}
37 sub sp, sp, #l_stacksize
39 mov r9
, r0
;DETOK *detoken
41 ldr r1
, [r9
, #detok_current_bc
]
42 ldr r0
, [r9
, #detok_qcoeff_start_ptr
]
51 str r0
, [sp, #l_qcoeff
]
57 add lr
, r9
, r7
, lsl #
2
59 ldr r2
, [r1
, #bool_decoder_buffer
]
60 ldr r3
, [r1
, #bool_decoder_pos
]
62 ldr r10
, [lr
, #detok_coef_probs
]
63 ldr r5
, [r1
, #bool_decoder_count
]
64 ldr r6
, [r1
, #bool_decoder_range
]
65 ldr r4
, [r1
, #bool_decoder_value
]
68 str r10
, [sp, #l_coef_ptr
]
73 ldr r3
, [r9
, #detok_ptr_onyxblock2context_leftabove
]
74 ldr r2
, [r9
, #DETOK_A
]
75 ldr r1
, [r9
, #DETOK_L
]
76 ldrb r12
, [r3
, +r11
] ; detoken->ptr_onyxblock2context_leftabove[i]
78 cmp r7
, #
0 ; check type
82 ldr r0
, [r2
, +r12
, lsl #
2] ; a
83 add r1
, r1
, r12
, lsl #
4
86 ldrb r2
, [r3
, #c_onyxblock2above_offset
]
87 ldrb r3
, [r3
, #c_onyxblock2left_offset
]
88 mov lr
, #c_entropy_nodes
91 ldr r2
, [r0
, +r2
, lsl #
2]!
92 add r3
, r1
, r3
, lsl #
2
93 str r3
, [sp, #l_l_ptr
]
101 str r0
, [sp, #l_a_ptr
]
102 smlabb r0
, r2
, lr
, r10
108 ldr r3
, [r9
, #detok_ptr_onyx_coef_bands_x
]
109 ldr lr
, [r9
, #detok_onyx_coef_tree_ptr
]
111 ;;the following two lines are used if onyx_coef_bands_x is UINT16
112 ;; add r3, r3, r7, lsl #1
115 ;;the following line is used if onyx_coef_bands_x is UINT8
126 ldrb r2
, [r0
, +r1
, asr #
1]
128 sub r3
, r3
, #
256 ;split = 1 + (((range-1) * probability) >> 8)
131 smlawb r2
, r3
, r2
, r10
132 ldrb r12
, [r8
] ;load cx data byte in stall slot
135 subs r3
, r4
, r2
, lsl #
24 ;x = value-(split<<24)
136 addhs r1
, r1
, #
1 ;t += 1
137 movhs r4
, r3
;update value
138 subhs r2
, r6
, r2
;range = range - split
141 ;;; ldrsbhs r1, [r1, +lr]
145 ;; use branch for short pipelines ???
147 ;; bcs |$LN22@decode_mb_to|
155 ;; use branch for short pipelines ???
156 ;; bgt |$LN22@decode_mb_to|
161 orrle r4
, r4
, r12
, lsl r3
163 ;;|$LN22@decode_mb_to|
168 cmn r1
, #c_dct_eob_token
;if(t == -DCT_EOB_TOKEN)
171 rsb lr
, r1
, #
0 ;v = -t;
173 cmp lr
, #
4 ;if(v > FOUR_TOKEN)
176 ldr r3
, [r9
, #detok_teb_base_ptr
]
178 add r7
, r3
, lr
, lsl #
4
180 ldrsh lr
, [r7
, #tokenextrabits_min_val
];v = teb_ptr->min_val
181 ldrsh r0
, [r7
, #tokenextrabits_length
];bits_count = teb_ptr->Length
188 sub r3
, r3
, #
256 ;split = 1 + (((range-1) * probability) >> 8)
191 smlawb r2
, r3
, r2
, r10
195 subs r10
, r4
, r2
, lsl #
24 ;x = value-(split<<24)
196 movhs r4
, r10
;update value
197 subhs r2
, r6
, r2
;range = range - split
198 addhs lr
, lr
, r11
, lsl r0
;v += ((UINT16)1<<bits_count)
199 movlo r6
, r2
;range = split
202 ;; use branch for short pipelines ???
204 ;; bcs |$LN10@decode_mb_to|
209 mov r6
, r2
, lsl r3
;range
210 mov r4
, r4
, lsl r3
;value
215 orrle r4
, r4
, r12
, lsl r3
217 ;;|$LN10@decode_mb_to|
223 ldr r11
, [sp, #l_qcoeff
]
224 ldr r0
, [sp, #l_coef_ptr
]
226 cmp r1
, #
0 ;check for nonzero token
227 beq SKIP_EOB_CHECK
;if t is zero, we will skip the eob table chec
229 sub r3
, r6
, #
1 ;range - 1
231 mov r3
, r3
, lsl #
7 ; *= onyx_prob_half (128)
234 add r2
, r3
, #
1 ;split
236 subs r3
, r4
, r2
, lsl #
24 ;x = value-(split<<24)
237 movhs r4
, r3
;update value
238 subhs r2
, r6
, r2
;range = range - split
240 addhs lr
, r3
, #
1 ;v = (v ^ -1) + 1
241 movlo r6
, r2
;range = split
243 ;; use branch for short pipelines ???
245 ;; bcs |$LN6@decode_mb_to|
255 orrle r4
, r4
, r2
, lsl r3
257 ;;|$LN6@decode_mb_to|
268 ldr r3
, [r9
, #detok_scan
]
270 cmp r7
, #
(0x10 - 1) ;assume one less for now.... increment below
272 ldr r3
, [r3
, +r7
, lsl #
2]
274 add r3
, r11
, r3
, lsl #
1
281 sub r7
, r7
, #
1 ;if(t != -DCT_EOB_TOKEN) --c
284 ldr r3
, [sp, #l_type
]
285 ldr r10
, [sp, #l_coef_ptr
]
286 ldr r0
, [sp, #l_qcoeff
]
288 ldr r12
, [sp, #l_stop
]
296 strb r7
, [r3
, #detok_eob
]
298 ldr r7
, [sp, #l_l_ptr
]
299 ldr r2
, [sp, #l_a_ptr
]
307 str r0
, [sp, #l_qcoeff
]
310 cmp r11
, r12
;i >= stop ?
311 ldr r7
, [sp, #l_type
]
319 ldr r12
, [r9
, #detok_qcoeff_start_ptr
]
320 ldr r10
, [r9
, #detok_coef_probs
]
323 str r12
, [sp, #l_qcoeff
]
325 str r7
, [sp, #l_type
]
326 str r3
, [sp, #l_stop
]
328 str r10
, [sp, #l_coef_ptr
]
341 str r7
, [sp, #l_type
]
342 str r3
, [sp, #l_stop
]
344 str r10
, [sp, #l_coef_ptr
]
352 ldr r3
, [r2
, #bool_decoder_buffer
]
353 str r5
, [r2
, #bool_decoder_count
]
354 str r4
, [r2
, #bool_decoder_value
]
356 str r3
, [r2
, #bool_decoder_pos
]
357 str r6
, [r2
, #bool_decoder_range
]
359 add sp, sp, #l_stacksize
360 ldmia
sp!, {r4 - r11, pc}
362 ENDP ; |vp8_decode_mb_tokens_v5|