summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
Diffstat (limited to 'vp8')
-rw-r--r--vp8/common/x86/loopfilter_sse2.asm309
-rwxr-xr-x[-rw-r--r--]vp8/decoder/decodemv.c652
-rw-r--r--vp8/decoder/decodframe.c22
-rw-r--r--vp8/decoder/demode.c149
-rw-r--r--vp8/decoder/demode.h33
-rw-r--r--vp8/decoder/onyxd_int.h6
-rw-r--r--vp8/decoder/xprintf.c164
-rw-r--r--vp8/decoder/xprintf.h33
-rw-r--r--vp8/encoder/tokenize.c6
-rw-r--r--vp8/encoder/tokenize.h8
-rw-r--r--vp8/vp8dx.mk2
11 files changed, 568 insertions, 816 deletions
diff --git a/vp8/common/x86/loopfilter_sse2.asm b/vp8/common/x86/loopfilter_sse2.asm
index 5839e43bf..57276b661 100644
--- a/vp8/common/x86/loopfilter_sse2.asm
+++ b/vp8/common/x86/loopfilter_sse2.asm
@@ -196,12 +196,12 @@
pxor xmm7, [t80 GLOBAL] ; q1 offset to convert to signed values
psubsb xmm2, xmm7 ; p1 - q1
- pand xmm2, xmm4 ; high var mask (hvm)(p1 - q1)
pxor xmm6, [t80 GLOBAL] ; offset to convert to signed values
+ pand xmm2, xmm4 ; high var mask (hvm)(p1 - q1)
pxor xmm0, [t80 GLOBAL] ; offset to convert to signed values
- movdqa xmm3, xmm0 ; q0
+ movdqa xmm3, xmm0 ; q0
psubsb xmm0, xmm6 ; q0 - p0
paddsb xmm2, xmm0 ; 1 * (q0 - p0) + hvm(p1 - q1)
paddsb xmm2, xmm0 ; 2 * (q0 - p0) + hvm(p1 - q1)
@@ -211,29 +211,28 @@
paddsb xmm1, [t4 GLOBAL] ; 3* (q0 - p0) + hvm(p1 - q1) + 4
paddsb xmm2, [t3 GLOBAL] ; 3* (q0 - p0) + hvm(p1 - q1) + 3
- pxor xmm0, xmm0
- pxor xmm5, xmm5
- punpcklbw xmm0, xmm2
- punpckhbw xmm5, xmm2
- psraw xmm0, 11
- psraw xmm5, 11
- packsswb xmm0, xmm5
- movdqa xmm2, xmm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
-
- pxor xmm0, xmm0 ; 0
- movdqa xmm5, xmm1 ; abcdefgh
- punpcklbw xmm0, xmm1 ; e0f0g0h0
+ punpckhbw xmm5, xmm2 ; axbxcxdx
+ punpcklbw xmm2, xmm2 ; exfxgxhx
+
+ psraw xmm5, 11 ; sign extended shift right by 3
+ psraw xmm2, 11 ; sign extended shift right by 3
+ packsswb xmm2, xmm5 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
+
+ punpcklbw xmm0, xmm1 ; exfxgxhx
+ punpckhbw xmm1, xmm1 ; axbxcxdx
+
psraw xmm0, 11 ; sign extended shift right by 3
- pxor xmm1, xmm1 ; 0
- punpckhbw xmm1, xmm5 ; a0b0c0d0
psraw xmm1, 11 ; sign extended shift right by 3
- movdqa xmm5, xmm0 ; save results
+ movdqa xmm5, xmm0 ; save results
packsswb xmm0, xmm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>3
+
paddsw xmm5, [ones GLOBAL]
paddsw xmm1, [ones GLOBAL]
+
psraw xmm5, 1 ; partial shifted one more time for 2nd tap
psraw xmm1, 1 ; partial shifted one more time for 2nd tap
+
packsswb xmm5, xmm1 ; (3* (q0 - p0) + hvm(p1 - q1) + 4) >>4
pandn xmm4, xmm5 ; high edge variance additive
%endmacro
@@ -433,29 +432,27 @@ sym(vp8_loop_filter_horizontal_edge_uv_sse2):
pand xmm2, xmm4; ; Filter2 = vp8_filter & hev
movdqa xmm5, xmm2
- paddsb xmm5, [t3 GLOBAL]
+ paddsb xmm5, [t3 GLOBAL] ; vp8_signed_char_clamp(Filter2 + 3)
+
+ punpckhbw xmm7, xmm5 ; axbxcxdx
+ punpcklbw xmm5, xmm5 ; exfxgxhx
- pxor xmm0, xmm0 ; 0
- pxor xmm7, xmm7 ; 0
- punpcklbw xmm0, xmm5 ; e0f0g0h0
- psraw xmm0, 11 ; sign extended shift right by 3
- punpckhbw xmm7, xmm5 ; a0b0c0d0
psraw xmm7, 11 ; sign extended shift right by 3
- packsswb xmm0, xmm7 ; Filter2 >>=3;
- movdqa xmm5, xmm0 ; Filter2
- paddsb xmm2, [t4 GLOBAL] ; vp8_signed_char_clamp(Filter2 + 4)
+ psraw xmm5, 11 ; sign extended shift right by 3
+
+ packsswb xmm5, xmm7 ; Filter2 >>=3;
+ paddsb xmm2, [t4 GLOBAL] ; vp8_signed_char_clamp(Filter2 + 4)
+
+ punpckhbw xmm7, xmm2 ; axbxcxdx
+ punpcklbw xmm0, xmm2 ; exfxgxhx
- pxor xmm0, xmm0 ; 0
- pxor xmm7, xmm7 ; 0
- punpcklbw xmm0, xmm2 ; e0f0g0h0
- psraw xmm0, 11 ; sign extended shift right by 3
- punpckhbw xmm7, xmm2 ; a0b0c0d0
psraw xmm7, 11 ; sign extended shift right by 3
- packsswb xmm0, xmm7 ; Filter2 >>=3;
+ psraw xmm0, 11 ; sign extended shift right by 3
- psubsb xmm3, xmm0 ; qs0 =qs0 - filter1
+ packsswb xmm0, xmm7 ; Filter2 >>=3;
paddsb xmm6, xmm5 ; ps0 =ps0 + Fitler2
+ psubsb xmm3, xmm0 ; qs0 =qs0 - filter1
pandn xmm4, xmm1 ; vp8_filter&=~hev
%endmacro
@@ -465,7 +462,6 @@ sym(vp8_loop_filter_horizontal_edge_uv_sse2):
; *oq0 = s^0x80;
; s = vp8_signed_char_clamp(ps0 + u);
; *op0 = s^0x80;
- pxor xmm0, xmm0
pxor xmm1, xmm1
pxor xmm2, xmm2
@@ -737,29 +733,30 @@ sym(vp8_mbloop_filter_horizontal_edge_uv_sse2):
%macro TRANSPOSE_16X8_1 0
- movq xmm0, QWORD PTR [rdi+rcx*2] ; xx xx xx xx xx xx xx xx 77 76 75 74 73 72 71 70
- movq xmm7, QWORD PTR [rsi+rcx*2] ; xx xx xx xx xx xx xx xx 67 66 65 64 63 62 61 60
+ movq xmm4, QWORD PTR [rsi] ; xx xx xx xx xx xx xx xx 07 06 05 04 03 02 01 00
+ movq xmm7, QWORD PTR [rdi] ; xx xx xx xx xx xx xx xx 17 16 15 14 13 12 11 10
- punpcklbw xmm7, xmm0 ; 77 67 76 66 75 65 74 64 73 63 72 62 71 61 70 60
- movq xmm0, QWORD PTR [rsi+rcx]
+ punpcklbw xmm4, xmm7 ; 17 07 16 06 15 05 14 04 13 03 12 02 11 01 10 00
+ movq xmm0, QWORD PTR [rsi+2*rax] ; xx xx xx xx xx xx xx xx 27 26 25 24 23 22 21 20
- movq xmm5, QWORD PTR [rsi] ;
- punpcklbw xmm5, xmm0 ; 57 47 56 46 55 45 54 44 53 43 52 42 51 41 50 40
+ movdqa xmm3, xmm4 ; 17 07 16 06 15 05 14 04 13 03 12 02 11 01 10 00
- movdqa xmm6, xmm5 ; 57 47 56 46 55 45 54 44 53 43 52 42 51 41 50 40
- punpcklwd xmm5, xmm7 ; 73 63 53 43 72 62 52 42 71 61 51 41 70 60 50 40
+ movq xmm7, QWORD PTR [rdi+2*rax] ; xx xx xx xx xx xx xx xx 37 36 35 34 33 32 31 30
+ punpcklbw xmm0, xmm7 ; 37 27 36 36 35 25 34 24 33 23 32 22 31 21 30 20
- punpckhwd xmm6, xmm7 ; 77 67 57 47 76 66 56 46 75 65 55 45 74 64 54 44
- movq xmm7, QWORD PTR [rsi + rax] ; xx xx xx xx xx xx xx xx 37 36 35 34 33 32 31 30
+ movq xmm5, QWORD PTR [rsi+4*rax] ; xx xx xx xx xx xx xx xx 47 46 45 44 43 42 41 40
+ movq xmm2, QWORD PTR [rdi+4*rax] ; xx xx xx xx xx xx xx xx 57 56 55 54 53 52 51 50
- movq xmm0, QWORD PTR [rsi + rax*2] ; xx xx xx xx xx xx xx xx 27 26 25 24 23 22 21 20
- punpcklbw xmm0, xmm7 ; 37 27 36 36 35 25 34 24 33 23 32 22 31 21 30 20
+ punpcklbw xmm5, xmm2 ; 57 47 56 46 55 45 54 44 53 43 52 42 51 41 50 40
+ movq xmm7, QWORD PTR [rsi+2*rcx] ; xx xx xx xx xx xx xx xx 67 66 65 64 63 62 61 60
- movq xmm4, QWORD PTR [rsi + rax*4] ; xx xx xx xx xx xx xx xx 07 06 05 04 03 02 01 00
- movq xmm7, QWORD PTR [rdi + rax*4] ; xx xx xx xx xx xx xx xx 17 16 15 14 13 12 11 10
+ movq xmm1, QWORD PTR [rdi+2*rcx] ; xx xx xx xx xx xx xx xx 77 76 75 74 73 72 71 70
+ movdqa xmm6, xmm5 ; 57 47 56 46 55 45 54 44 53 43 52 42 51 41 50 40
- punpcklbw xmm4, xmm7 ; 17 07 16 06 15 05 14 04 13 03 12 02 11 01 10 00
- movdqa xmm3, xmm4 ; 17 07 16 06 15 05 14 04 13 03 12 02 11 01 10 00
+ punpcklbw xmm7, xmm1 ; 77 67 76 66 75 65 74 64 73 63 72 62 71 61 70 60
+ punpcklwd xmm5, xmm7 ; 73 63 53 43 72 62 52 42 71 61 51 41 70 60 50 40
+
+ punpckhwd xmm6, xmm7 ; 77 67 57 47 76 66 56 46 75 65 55 45 74 64 54 44
punpcklwd xmm3, xmm0 ; 33 23 13 03 32 22 12 02 31 21 11 01 30 20 10 00
punpckhwd xmm4, xmm0 ; 37 27 17 07 36 26 16 06 35 25 15 05 34 24 14 04
@@ -777,28 +774,28 @@ sym(vp8_mbloop_filter_horizontal_edge_uv_sse2):
%endmacro
%macro TRANSPOSE_16X8_2 1
- movq xmm6, QWORD PTR [rdi+rcx*2] ; xx xx xx xx xx xx xx xx f7 f6 f5 f4 f3 f2 f1 f0
- movq xmm5, QWORD PTR [rsi+rcx*2] ; xx xx xx xx xx xx xx xx e7 e6 e5 e4 e3 e2 e1 e0
+ movq xmm2, QWORD PTR [rsi] ; xx xx xx xx xx xx xx xx 87 86 85 84 83 82 81 80
+ movq xmm5, QWORD PTR [rdi] ; xx xx xx xx xx xx xx xx 97 96 95 94 93 92 91 90
- punpcklbw xmm5, xmm6 ; f7 e7 f6 e6 f5 e5 f4 e4 f3 e3 f2 e2 f1 e1 f0 e0
- movq xmm6, QWORD PTR [rsi+rcx] ; xx xx xx xx xx xx xx xx d7 d6 d5 d4 d3 d2 d1 d0
+ punpcklbw xmm2, xmm5 ; 97 87 96 86 95 85 94 84 93 83 92 82 91 81 90 80
+ movq xmm0, QWORD PTR [rsi+2*rax] ; xx xx xx xx xx xx xx xx a7 a6 a5 a4 a3 a2 a1 a0
+
+ movq xmm5, QWORD PTR [rdi+2*rax] ; xx xx xx xx xx xx xx xx b7 b6 b5 b4 b3 b2 b1 b0
+ punpcklbw xmm0, xmm5 ; b7 a7 b6 a6 b5 a5 b4 a4 b3 a3 b2 a2 b1 a1 b0 a0
+
+ movq xmm1, QWORD PTR [rsi+4*rax] ; xx xx xx xx xx xx xx xx c7 c6 c5 c4 c3 c2 c1 c0
+ movq xmm6, QWORD PTR [rdi+4*rax] ; xx xx xx xx xx xx xx xx d7 d6 d5 d4 d3 d2 d1 d0
- movq xmm1, QWORD PTR [rsi] ; xx xx xx xx xx xx xx xx c7 c6 c5 c4 c3 c2 c1 c0
punpcklbw xmm1, xmm6 ; d7 c7 d6 c6 d5 c5 d4 c4 d3 c3 d2 c2 d1 e1 d0 c0
+ movq xmm5, QWORD PTR [rsi+2*rcx] ; xx xx xx xx xx xx xx xx e7 e6 e5 e4 e3 e2 e1 e0
+
+ movq xmm6, QWORD PTR [rdi+2*rcx] ; xx xx xx xx xx xx xx xx f7 f6 f5 f4 f3 f2 f1 f0
+ punpcklbw xmm5, xmm6 ; f7 e7 f6 e6 f5 e5 f4 e4 f3 e3 f2 e2 f1 e1 f0 e0
movdqa xmm6, xmm1 ;
punpckhwd xmm6, xmm5 ; f7 e7 d7 c7 f6 e6 d6 c6 f5 e5 d5 c5 f4 e4 d4 c4
punpcklwd xmm1, xmm5 ; f3 e3 d3 c3 f2 e2 d2 c2 f1 e1 d1 c1 f0 e0 d0 c0
- movq xmm5, QWORD PTR [rsi+rax] ; xx xx xx xx xx xx xx xx b7 b6 b5 b4 b3 b2 b1 b0
-
- movq xmm0, QWORD PTR [rsi+rax*2] ; xx xx xx xx xx xx xx xx a7 a6 a5 a4 a3 a2 a1 a0
- punpcklbw xmm0, xmm5 ; b7 a7 b6 a6 b5 a5 b4 a4 b3 a3 b2 a2 b1 a1 b0 a0
-
- movq xmm2, QWORD PTR [rsi+rax*4] ; xx xx xx xx xx xx xx xx 87 86 85 84 83 82 81 80
- movq xmm5, QWORD PTR [rdi+rax*4] ; xx xx xx xx xx xx xx xx 97 96 95 94 93 92 91 90
-
- punpcklbw xmm2, xmm5 ; 97 87 96 86 95 85 94 84 93 83 92 82 91 81 90 80
movdqa xmm5, xmm2 ; 97 87 96 86 95 85 94 84 93 83 92 82 91 81 90 80
punpcklwd xmm5, xmm0 ; b3 a3 93 83 b2 a2 92 82 b1 a1 91 81 b0 a0 90 80
@@ -995,7 +992,6 @@ sym(vp8_mbloop_filter_horizontal_edge_uv_sse2):
lea rdx, srct
movdqa xmm2, [rdx] ; p1 lea rsi, [rsi+rcx*8]
- lea rdi, [rsi+rcx]
movdqa xmm7, [rdx+48] ; q1
movdqa xmm6, [rdx+16] ; p0
movdqa xmm0, [rdx+32] ; q0
@@ -1022,28 +1018,19 @@ sym(vp8_mbloop_filter_horizontal_edge_uv_sse2):
paddsb xmm1, [t4 GLOBAL] ; 3* (q0 - p0) + hvm(p1 - q1) + 4
paddsb xmm2, [t3 GLOBAL] ; 3* (q0 - p0) + hvm(p1 - q1) + 3
- pxor xmm0, xmm0
-
- pxor xmm5, xmm5
- punpcklbw xmm0, xmm2
punpckhbw xmm5, xmm2
- psraw xmm0, 11
+ punpcklbw xmm2, xmm2
psraw xmm5, 11
- packsswb xmm0, xmm5
-
- movdqa xmm2, xmm0 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
+ psraw xmm2, 11
- pxor xmm0, xmm0 ; 0
- movdqa xmm5, xmm1 ; abcdefgh
+ packsswb xmm2, xmm5 ; (3* (q0 - p0) + hvm(p1 - q1) + 3) >> 3;
+ punpcklbw xmm0, xmm1 ; exfxgxhx
- punpcklbw xmm0, xmm1 ; e0f0g0h0
+ punpckhbw xmm1, xmm1 ; axbxcxdx
psraw xmm0, 11 ; sign extended shift right by 3
- pxor xmm1, xmm1 ; 0
- punpckhbw xmm1, xmm5 ; a0b0c0d0
-
psraw xmm1, 11 ; sign extended shift right by 3
movdqa xmm5, xmm0 ; save results
@@ -1103,27 +1090,27 @@ sym(vp8_mbloop_filter_horizontal_edge_uv_sse2):
%endmacro
%macro BV_WRITEBACK 2
- movd [rsi+rax*4+2], %1
+ movd [rsi+2], %1
psrldq %1, 4
- movd [rdi+rax*4+2], %1
+ movd [rdi+2], %1
psrldq %1, 4
- movd [rsi+rax*2+2], %1
+ movd [rsi+2*rax+2], %1
psrldq %1, 4
- movd [rdi+rax*2+2], %1
+ movd [rdi+2*rax+2], %1
- movd [rsi+2], %2
+ movd [rsi+4*rax+2], %2
psrldq %2, 4
- movd [rdi+2], %2
+ movd [rdi+4*rax+2], %2
psrldq %2, 4
- movd [rdi+rcx+2], %2
+ movd [rsi+2*rcx+2], %2
psrldq %2, 4
- movd [rdi+rcx*2+2], %2
+ movd [rdi+2*rcx+2], %2
%endmacro
@@ -1156,16 +1143,15 @@ sym(vp8_loop_filter_vertical_edge_sse2):
mov rsi, arg(0) ; src_ptr
movsxd rax, dword ptr arg(1) ; src_pixel_step
- lea rsi, [rsi + rax*4 - 4]
+ lea rsi, [rsi - 4]
lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- mov rcx, rax
- neg rax
+ lea rcx, [rax*2+rax]
;transpose 16x8 to 8x16, and store the 8-line result on stack.
TRANSPOSE_16X8_1
- lea rsi, [rsi+rcx*8]
- lea rdi, [rdi+rcx*8]
+ lea rsi, [rsi+rax*8]
+ lea rdi, [rdi+rax*8]
lea rdx, srct
TRANSPOSE_16X8_2 1
@@ -1180,10 +1166,14 @@ sym(vp8_loop_filter_vertical_edge_sse2):
; tranpose and write back - only work on q1, q0, p0, p1
BV_TRANSPOSE
; store 16-line result
+
+ lea rdx, [rax]
+ neg rdx
+
BV_WRITEBACK xmm1, xmm5
- lea rsi, [rsi+rax*8]
- lea rdi, [rsi+rcx]
+ lea rsi, [rsi+rdx*8]
+ lea rdi, [rdi+rdx*8]
BV_WRITEBACK xmm2, xmm6
add rsp, 96
@@ -1227,17 +1217,16 @@ sym(vp8_loop_filter_vertical_edge_uv_sse2):
mov rsi, arg(0) ; u_ptr
movsxd rax, dword ptr arg(1) ; src_pixel_step
- lea rsi, [rsi + rax*4 - 4]
+ lea rsi, [rsi - 4]
lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- mov rcx, rax
- neg rax
+ lea rcx, [rax+2*rax]
;transpose 16x8 to 8x16, and store the 8-line result on stack.
TRANSPOSE_16X8_1
- mov rsi, arg(5) ; v_ptr
- lea rsi, [rsi + rcx*4 - 4]
- lea rdi, [rsi + rcx] ; rdi points to row +1 for indirect addressing
+ mov rsi, arg(5) ; v_ptr
+ lea rsi, [rsi - 4]
+ lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
lea rdx, srct
TRANSPOSE_16X8_2 1
@@ -1252,12 +1241,15 @@ sym(vp8_loop_filter_vertical_edge_uv_sse2):
; tranpose and write back - only work on q1, q0, p0, p1
BV_TRANSPOSE
+
+ lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
+
; store 16-line result
BV_WRITEBACK xmm1, xmm5
- mov rsi, arg(0) ;u_ptr
- lea rsi, [rsi + rcx*4 - 4]
- lea rdi, [rsi + rcx]
+ mov rsi, arg(0) ; u_ptr
+ lea rsi, [rsi - 4]
+ lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
BV_WRITEBACK xmm2, xmm6
add rsp, 96
@@ -1303,28 +1295,22 @@ sym(vp8_loop_filter_vertical_edge_uv_sse2):
movdqa xmm5, xmm2
paddsb xmm5, [t3 GLOBAL]
- pxor xmm0, xmm0 ; 0
- pxor xmm7, xmm7 ; 0
+ punpckhbw xmm7, xmm5 ; axbxcxdx
+ punpcklbw xmm5, xmm5 ; exfxgxhx
- punpcklbw xmm0, xmm5 ; e0f0g0h0
- psraw xmm0, 11 ; sign extended shift right by 3
-
- punpckhbw xmm7, xmm5 ; a0b0c0d0
psraw xmm7, 11 ; sign extended shift right by 3
+ psraw xmm5, 11 ; sign extended shift right by 3
- packsswb xmm0, xmm7 ; Filter2 >>=3;
- movdqa xmm5, xmm0 ; Filter2
+ packsswb xmm5, xmm7 ; Filter2 >>=3;
paddsb xmm2, [t4 GLOBAL] ; vp8_signed_char_clamp(Filter2 + 4)
- pxor xmm0, xmm0 ; 0
- pxor xmm7, xmm7 ; 0
- punpcklbw xmm0, xmm2 ; e0f0g0h0
+ punpcklbw xmm0, xmm2 ; exfxgxhx
+ punpckhbw xmm7, xmm2 ; axbxcxdx
psraw xmm0, 11 ; sign extended shift right by 3
- punpckhbw xmm7, xmm2 ; a0b0c0d0
-
psraw xmm7, 11 ; sign extended shift right by 3
+
packsswb xmm0, xmm7 ; Filter2 >>=3;
psubsb xmm3, xmm0 ; qs0 =qs0 - filter1
@@ -1339,7 +1325,6 @@ sym(vp8_loop_filter_vertical_edge_uv_sse2):
; *oq0 = s^0x80;
; s = vp8_signed_char_clamp(ps0 + u);
; *op0 = s^0x80;
- pxor xmm0, xmm0
pxor xmm1, xmm1
pxor xmm2, xmm2
@@ -1479,28 +1464,30 @@ sym(vp8_loop_filter_vertical_edge_uv_sse2):
%endmacro
%macro MBV_WRITEBACK_1 0
- movq QWORD PTR [rsi+rax*4], xmm0
+ movq QWORD PTR [rsi], xmm0
psrldq xmm0, 8
- movq QWORD PTR [rsi+rax*2], xmm6
+ movq QWORD PTR [rdi], xmm0
+
+ movq QWORD PTR [rsi+2*rax], xmm6
psrldq xmm6, 8
- movq QWORD PTR [rdi+rax*4], xmm0
- movq QWORD PTR [rsi+rax], xmm6
+ movq QWORD PTR [rdi+2*rax], xmm6
movdqa xmm0, xmm5 ; 73 72 71 70 63 62 61 60 53 52 51 50 43 42 41 40
punpckldq xmm0, xmm7 ; 57 56 55 54 53 52 51 50 47 46 45 44 43 42 41 40
punpckhdq xmm5, xmm7 ; 77 76 75 74 73 72 71 70 67 66 65 64 63 62 61 60
- movq QWORD PTR [rsi], xmm0
+ movq QWORD PTR [rsi+4*rax], xmm0
psrldq xmm0, 8
- movq QWORD PTR [rsi+rcx*2], xmm5
+ movq QWORD PTR [rdi+4*rax], xmm0
+
+ movq QWORD PTR [rsi+2*rcx], xmm5
psrldq xmm5, 8
- movq QWORD PTR [rsi+rcx], xmm0
- movq QWORD PTR [rdi+rcx*2], xmm5
+ movq QWORD PTR [rdi+2*rcx], xmm5
movdqa xmm2, [rdx+64] ; f4 e4 d4 c4 b4 a4 94 84 74 64 54 44 34 24 14 04
punpckhbw xmm2, [rdx+80] ; f5 f4 e5 e4 d5 d4 c5 c4 b5 b4 a5 a4 95 94 85 84
@@ -1518,28 +1505,30 @@ sym(vp8_loop_filter_vertical_edge_uv_sse2):
%endmacro
%macro MBV_WRITEBACK_2 0
- movq QWORD PTR [rsi+rax*4], xmm1
+ movq QWORD PTR [rsi], xmm1
psrldq xmm1, 8
- movq QWORD PTR [rsi+rax*2], xmm3
+ movq QWORD PTR [rdi], xmm1
+
+ movq QWORD PTR [rsi+2*rax], xmm3
psrldq xmm3, 8
- movq QWORD PTR [rdi+rax*4], xmm1
- movq QWORD PTR [rsi+rax], xmm3
+ movq QWORD PTR [rdi+2*rax], xmm3
movdqa xmm1, xmm4 ; f3 f2 f1 f0 e3 e2 e1 e0 d3 d2 d1 d0 c3 c2 c1 c0
punpckldq xmm1, xmm2 ; d7 d6 d5 d4 d3 d2 d1 d0 c7 c6 c5 c4 c3 c2 c1 c0
punpckhdq xmm4, xmm2 ; f7 f6 f4 f4 f3 f2 f1 f0 e7 e6 e5 e4 e3 e2 e1 e0
- movq QWORD PTR [rsi], xmm1
+ movq QWORD PTR [rsi+4*rax], xmm1
psrldq xmm1, 8
- movq QWORD PTR [rsi+rcx*2], xmm4
+ movq QWORD PTR [rdi+4*rax], xmm1
+
+ movq QWORD PTR [rsi+2*rcx], xmm4
psrldq xmm4, 8
- movq QWORD PTR [rsi+rcx], xmm1
- movq QWORD PTR [rdi+rcx*2], xmm4
+ movq QWORD PTR [rdi+2*rcx], xmm4
%endmacro
@@ -1569,20 +1558,19 @@ sym(vp8_mbloop_filter_vertical_edge_sse2):
%define t1 [rsp + 16] ;__declspec(align(16)) char t1[16];
%define srct [rsp + 32] ;__declspec(align(16)) char srct[128];
- mov rsi, arg(0) ;src_ptr
- movsxd rax, dword ptr arg(1) ;src_pixel_step
+ mov rsi, arg(0) ; src_ptr
+ movsxd rax, dword ptr arg(1) ; src_pixel_step
- lea rsi, [rsi + rax*4 - 4]
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- mov rcx, rax
- neg rax
+ lea rsi, [rsi - 4]
+ lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
+ lea rcx, [rax*2+rax]
; Transpose
TRANSPOSE_16X8_1
- lea rsi, [rsi+rcx*8]
- lea rdi, [rdi+rcx*8]
- lea rdx, srct
+ lea rsi, [rsi+rax*8]
+ lea rdi, [rdi+rax*8]
+ lea rdx, srct
TRANSPOSE_16X8_2 0
; calculate filter mask
@@ -1590,18 +1578,22 @@ sym(vp8_mbloop_filter_vertical_edge_sse2):
; calculate high edge variance
LFV_HEV_MASK
+ neg rax
; start work on filters
MBV_FILTER
+ lea rsi, [rsi+rax*8]
+ lea rdi, [rdi+rax*8]
+
; transpose and write back
MBV_TRANSPOSE
- lea rsi, [rsi+rax*8]
- lea rdi, [rdi+rax*8]
+ neg rax
+
MBV_WRITEBACK_1
- lea rsi, [rsi+rcx*8]
- lea rdi, [rdi+rcx*8]
+ lea rsi, [rsi+rax*8]
+ lea rdi, [rdi+rax*8]
MBV_WRITEBACK_2
add rsp, 160
@@ -1642,21 +1634,20 @@ sym(vp8_mbloop_filter_vertical_edge_uv_sse2):
%define t1 [rsp + 16] ;__declspec(align(16)) char t1[16];
%define srct [rsp + 32] ;__declspec(align(16)) char srct[128];
- mov rsi, arg(0) ;u_ptr
- movsxd rax, dword ptr arg(1) ; src_pixel_step
+ mov rsi, arg(0) ; u_ptr
+ movsxd rax, dword ptr arg(1) ; src_pixel_step
- lea rsi, [rsi + rax*4 - 4]
- lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
- mov rcx, rax
- neg rax
+ lea rsi, [rsi - 4]
+ lea rdi, [rsi + rax] ; rdi points to row +1 for indirect addressing
+ lea rcx, [rax+2*rax]
; Transpose
TRANSPOSE_16X8_1
; XMM3 XMM4 XMM7 in use
- mov rsi, arg(5) ;v_ptr
- lea rsi, [rsi + rcx*4 - 4]
- lea rdi, [rsi + rcx]
+ mov rsi, arg(5) ; v_ptr
+ lea rsi, [rsi - 4]
+ lea rdi, [rsi + rax]
lea rdx, srct
TRANSPOSE_16X8_2 0
@@ -1672,12 +1663,12 @@ sym(vp8_mbloop_filter_vertical_edge_uv_sse2):
MBV_TRANSPOSE
mov rsi, arg(0) ;u_ptr
- lea rsi, [rsi + rcx*4 - 4]
- lea rdi, [rsi + rcx]
+ lea rsi, [rsi - 4]
+ lea rdi, [rsi + rax]
MBV_WRITEBACK_1
mov rsi, arg(5) ;v_ptr
- lea rsi, [rsi + rcx*4 - 4]
- lea rdi, [rsi + rcx]
+ lea rsi, [rsi - 4]
+ lea rdi, [rsi + rax]
MBV_WRITEBACK_2
add rsp, 160
diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
index da68ee688..e9281f7ae 100644..100755
--- a/vp8/decoder/decodemv.c
+++ b/vp8/decoder/decodemv.c
@@ -14,10 +14,126 @@
#include "entropymode.h"
#include "onyxd_int.h"
#include "findnearmv.h"
-#include "demode.h"
+
#if CONFIG_DEBUG
#include <assert.h>
#endif
+static int vp8_read_bmode(vp8_reader *bc, const vp8_prob *p)
+{
+ const int i = vp8_treed_read(bc, vp8_bmode_tree, p);
+
+ return i;
+}
+
+
+static int vp8_read_ymode(vp8_reader *bc, const vp8_prob *p)
+{
+ const int i = vp8_treed_read(bc, vp8_ymode_tree, p);
+
+ return i;
+}
+
+static int vp8_kfread_ymode(vp8_reader *bc, const vp8_prob *p)
+{
+ const int i = vp8_treed_read(bc, vp8_kf_ymode_tree, p);
+
+ return i;
+}
+
+
+
+static int vp8_read_uv_mode(vp8_reader *bc, const vp8_prob *p)
+{
+ const int i = vp8_treed_read(bc, vp8_uv_mode_tree, p);
+
+ return i;
+}
+
+static void vp8_read_mb_features(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x)
+{
+ // Is segmentation enabled
+ if (x->segmentation_enabled && x->update_mb_segmentation_map)
+ {
+ // If so then read the segment id.
+ if (vp8_read(r, x->mb_segment_tree_probs[0]))
+ mi->segment_id = (unsigned char)(2 + vp8_read(r, x->mb_segment_tree_probs[2]));
+ else
+ mi->segment_id = (unsigned char)(vp8_read(r, x->mb_segment_tree_probs[1]));
+ }
+}
+
+static void vp8_kfread_modes(VP8D_COMP *pbi, MODE_INFO *m, int mb_row, int mb_col)
+{
+ vp8_reader *const bc = & pbi->bc;
+ const int mis = pbi->common.mode_info_stride;
+
+ {
+ MB_PREDICTION_MODE y_mode;
+
+ // Read the Macroblock segmentation map if it is being updated explicitly this frame (reset to 0 above by default)
+ // By default on a key frame reset all MBs to segment 0
+ m->mbmi.segment_id = 0;
+
+ if (pbi->mb.update_mb_segmentation_map)
+ vp8_read_mb_features(bc, &m->mbmi, &pbi->mb);
+
+ // Read the macroblock coeff skip flag if this feature is in use, else default to 0
+ if (pbi->common.mb_no_coeff_skip)
+ m->mbmi.mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
+ else
+ m->mbmi.mb_skip_coeff = 0;
+
+ y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(bc, pbi->common.kf_ymode_prob);
+
+ m->mbmi.ref_frame = INTRA_FRAME;
+
+ if ((m->mbmi.mode = y_mode) == B_PRED)
+ {
+ int i = 0;
+
+ do
+ {
+ const B_PREDICTION_MODE A = vp8_above_bmi(m, i, mis)->mode;
+ const B_PREDICTION_MODE L = vp8_left_bmi(m, i)->mode;
+
+ m->bmi[i].mode = (B_PREDICTION_MODE) vp8_read_bmode(bc, pbi->common.kf_bmode_prob [A] [L]);
+ }
+ while (++i < 16);
+ }
+ else
+ {
+ int BMode;
+ int i = 0;
+
+ switch (y_mode)
+ {
+ case DC_PRED:
+ BMode = B_DC_PRED;
+ break;
+ case V_PRED:
+ BMode = B_VE_PRED;
+ break;
+ case H_PRED:
+ BMode = B_HE_PRED;
+ break;
+ case TM_PRED:
+ BMode = B_TM_PRED;
+ break;
+ default:
+ BMode = B_DC_PRED;
+ break;
+ }
+
+ do
+ {
+ m->bmi[i].mode = (B_PREDICTION_MODE)BMode;
+ }
+ while (++i < 16);
+ }
+
+ m->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc, pbi->common.kf_uv_mode_prob);
+ }
+}
static int read_mvcomponent(vp8_reader *r, const MV_CONTEXT *mvc)
{
@@ -99,6 +215,8 @@ static MB_PREDICTION_MODE sub_mv_ref(vp8_reader *bc, const vp8_prob *p)
return (MB_PREDICTION_MODE)i;
}
+
+#ifdef VPX_MODE_COUNT
unsigned int vp8_mv_cont_count[5][4] =
{
{ 0, 0, 0, 0 },
@@ -107,310 +225,327 @@ unsigned int vp8_mv_cont_count[5][4] =
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
};
+#endif
-void vp8_decode_mode_mvs(VP8D_COMP *pbi)
-{
- const MV Zero = { 0, 0};
+unsigned char vp8_mbsplit_offset[4][16] = {
+ { 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 0, 2, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
+};
- VP8_COMMON *const pc = & pbi->common;
- vp8_reader *const bc = & pbi->bc;
+unsigned char vp8_mbsplit_fill_count[4] = {8, 8, 4, 1};
+unsigned char vp8_mbsplit_fill_offset[4][16] = {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
+ { 0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15},
+ { 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15},
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
+};
- MODE_INFO *mi = pc->mi, *ms;
- const int mis = pc->mode_info_stride;
- MV_CONTEXT *const mvc = pc->fc.mvc;
- int mb_row = -1;
- vp8_prob prob_intra;
- vp8_prob prob_last;
- vp8_prob prob_gf;
- vp8_prob prob_skip_false = 0;
+void vp8_mb_mode_mv_init(VP8D_COMP *pbi)
+{
+ vp8_reader *const bc = & pbi->bc;
+ MV_CONTEXT *const mvc = pbi->common.fc.mvc;
- if (pc->mb_no_coeff_skip)
- prob_skip_false = (vp8_prob)vp8_read_literal(bc, 8);
+ pbi->prob_skip_false = 0;
+ if (pbi->common.mb_no_coeff_skip)
+ pbi->prob_skip_false = (vp8_prob)vp8_read_literal(bc, 8);
- prob_intra = (vp8_prob)vp8_read_literal(bc, 8);
- prob_last = (vp8_prob)vp8_read_literal(bc, 8);
- prob_gf = (vp8_prob)vp8_read_literal(bc, 8);
+ if(pbi->common.frame_type != KEY_FRAME)
+ {
+ pbi->prob_intra = (vp8_prob)vp8_read_literal(bc, 8);
+ pbi->prob_last = (vp8_prob)vp8_read_literal(bc, 8);
+ pbi->prob_gf = (vp8_prob)vp8_read_literal(bc, 8);
- ms = pc->mi - 1;
+ if (vp8_read_bit(bc))
+ {
+ int i = 0;
- if (vp8_read_bit(bc))
- {
- int i = 0;
+ do
+ {
+ pbi->common.fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
+ }
+ while (++i < 4);
+ }
- do
+ if (vp8_read_bit(bc))
{
- pc->fc.ymode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
+ int i = 0;
+
+ do
+ {
+ pbi->common.fc.uv_mode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
+ }
+ while (++i < 3);
}
- while (++i < 4);
+
+ read_mvcontexts(bc, mvc);
}
+}
- if (vp8_read_bit(bc))
+void vp8_read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
+ int mb_row, int mb_col)
+{
+ const MV Zero = { 0, 0};
+ vp8_reader *const bc = & pbi->bc;
+ MV_CONTEXT *const mvc = pbi->common.fc.mvc;
+ const int mis = pbi->common.mode_info_stride;
+
+ MV *const mv = & mbmi->mv.as_mv;
+ int mb_to_left_edge;
+ int mb_to_right_edge;
+ int mb_to_top_edge;
+ int mb_to_bottom_edge;
+
+ mb_to_top_edge = pbi->mb.mb_to_top_edge;
+ mb_to_bottom_edge = pbi->mb.mb_to_bottom_edge;
+ mb_to_top_edge -= LEFT_TOP_MARGIN;
+ mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
+
+ mbmi->need_to_clamp_mvs = 0;
+ // Distance of Mb to the various image edges.
+ // These specified to 8th pel as they are always compared to MV values that are in 1/8th pel units
+ pbi->mb.mb_to_left_edge =
+ mb_to_left_edge = -((mb_col * 16) << 3);
+ mb_to_left_edge -= LEFT_TOP_MARGIN;
+
+ pbi->mb.mb_to_right_edge =
+ mb_to_right_edge = ((pbi->common.mb_cols - 1 - mb_col) * 16) << 3;
+ mb_to_right_edge += RIGHT_BOTTOM_MARGIN;
+
+ // If required read in new segmentation data for this MB
+ if (pbi->mb.update_mb_segmentation_map)
+ vp8_read_mb_features(bc, mbmi, &pbi->mb);
+
+ // Read the macroblock coeff skip flag if this feature is in use, else default to 0
+ if (pbi->common.mb_no_coeff_skip)
+ mbmi->mb_skip_coeff = vp8_read(bc, pbi->prob_skip_false);
+ else
+ mbmi->mb_skip_coeff = 0;
+
+ if ((mbmi->ref_frame = (MV_REFERENCE_FRAME) vp8_read(bc, pbi->prob_intra))) /* inter MB */
{
- int i = 0;
+ int rct[4];
+ vp8_prob mv_ref_p [VP8_MVREFS-1];
+ MV nearest, nearby, best_mv;
- do
+ if (vp8_read(bc, pbi->prob_last))
{
- pc->fc.uv_mode_prob[i] = (vp8_prob) vp8_read_literal(bc, 8);
+ mbmi->ref_frame = (MV_REFERENCE_FRAME)((int)mbmi->ref_frame + (int)(1 + vp8_read(bc, pbi->prob_gf)));
}
- while (++i < 3);
- }
- read_mvcontexts(bc, mvc);
+ vp8_find_near_mvs(&pbi->mb, mi, &nearest, &nearby, &best_mv, rct, mbmi->ref_frame, pbi->common.ref_frame_sign_bias);
- while (++mb_row < pc->mb_rows)
- {
- int mb_col = -1;
+ vp8_mv_ref_probs(mv_ref_p, rct);
- while (++mb_col < pc->mb_cols)
+ mbmi->uv_mode = DC_PRED;
+ switch (mbmi->mode = read_mv_ref(bc, mv_ref_p))
{
- MB_MODE_INFO *const mbmi = & mi->mbmi;
- MV *const mv = & mbmi->mv.as_mv;
- VP8_COMMON *const pc = &pbi->common;
- MACROBLOCKD *xd = &pbi->mb;
-
- mbmi->need_to_clamp_mvs = 0;
- // Distance of Mb to the various image edges.
- // These specified to 8th pel as they are always compared to MV values that are in 1/8th pel units
- xd->mb_to_left_edge = -((mb_col * 16) << 3);
- xd->mb_to_right_edge = ((pc->mb_cols - 1 - mb_col) * 16) << 3;
- xd->mb_to_top_edge = -((mb_row * 16)) << 3;
- xd->mb_to_bottom_edge = ((pc->mb_rows - 1 - mb_row) * 16) << 3;
-
- // If required read in new segmentation data for this MB
- if (pbi->mb.update_mb_segmentation_map)
- vp8_read_mb_features(bc, mbmi, &pbi->mb);
+ case SPLITMV:
+ {
+ const int s = mbmi->partitioning =
+ vp8_treed_read(bc, vp8_mbsplit_tree, vp8_mbsplit_probs);
+ const int num_p = vp8_mbsplit_count [s];
+ int j = 0;
- // Read the macroblock coeff skip flag if this feature is in use, else default to 0
- if (pc->mb_no_coeff_skip)
- mbmi->mb_skip_coeff = vp8_read(bc, prob_skip_false);
- else
- mbmi->mb_skip_coeff = 0;
+ do /* for each subset j */
+ {
+ B_MODE_INFO bmi;
+ MV *const mv = & bmi.mv.as_mv;
- mbmi->uv_mode = DC_PRED;
+ int k; /* first block in subset j */
+ int mv_contz;
+ k = vp8_mbsplit_offset[s][j];
- if ((mbmi->ref_frame = (MV_REFERENCE_FRAME) vp8_read(bc, prob_intra))) /* inter MB */
- {
- int rct[4];
- vp8_prob mv_ref_p [VP8_MVREFS-1];
- MV nearest, nearby, best_mv;
+ mv_contz = vp8_mv_cont(&(vp8_left_bmi(mi, k)->mv.as_mv), &(vp8_above_bmi(mi, k, mis)->mv.as_mv));
- if (vp8_read(bc, prob_last))
+ switch (bmi.mode = (B_PREDICTION_MODE) sub_mv_ref(bc, vp8_sub_mv_ref_prob2 [mv_contz])) //pc->fc.sub_mv_ref_prob))
{
- mbmi->ref_frame = (MV_REFERENCE_FRAME)((int)mbmi->ref_frame + (int)(1 + vp8_read(bc, prob_gf)));
+ case NEW4X4:
+ read_mv(bc, mv, (const MV_CONTEXT *) mvc);
+ mv->row += best_mv.row;
+ mv->col += best_mv.col;
+ #ifdef VPX_MODE_COUNT
+ vp8_mv_cont_count[mv_contz][3]++;
+ #endif
+ break;
+ case LEFT4X4:
+ *mv = vp8_left_bmi(mi, k)->mv.as_mv;
+ #ifdef VPX_MODE_COUNT
+ vp8_mv_cont_count[mv_contz][0]++;
+ #endif
+ break;
+ case ABOVE4X4:
+ *mv = vp8_above_bmi(mi, k, mis)->mv.as_mv;
+ #ifdef VPX_MODE_COUNT
+ vp8_mv_cont_count[mv_contz][1]++;
+ #endif
+ break;
+ case ZERO4X4:
+ *mv = Zero;
+ #ifdef VPX_MODE_COUNT
+ vp8_mv_cont_count[mv_contz][2]++;
+ #endif
+ break;
+ default:
+ break;
}
- vp8_find_near_mvs(xd, mi, &nearest, &nearby, &best_mv, rct, mbmi->ref_frame, pbi->common.ref_frame_sign_bias);
+ mbmi->need_to_clamp_mvs = (mv->col < mb_to_left_edge) ? 1 : 0;
+ mbmi->need_to_clamp_mvs |= (mv->col > mb_to_right_edge) ? 1 : 0;
+ mbmi->need_to_clamp_mvs |= (mv->row < mb_to_top_edge) ? 1 : 0;
+ mbmi->need_to_clamp_mvs |= (mv->row > mb_to_bottom_edge) ? 1 : 0;
- vp8_mv_ref_probs(mv_ref_p, rct);
-
- switch (mbmi->mode = read_mv_ref(bc, mv_ref_p))
- {
- case SPLITMV:
{
- const int s = mbmi->partitioning = vp8_treed_read(
- bc, vp8_mbsplit_tree, vp8_mbsplit_probs
- );
- const int num_p = vp8_mbsplit_count [s];
- const int *const L = vp8_mbsplits [s];
- int j = 0;
-
- do /* for each subset j */
- {
- B_MODE_INFO bmi;
- MV *const mv = & bmi.mv.as_mv;
-
- int k = -1; /* first block in subset j */
- int mv_contz;
-
- while (j != L[++k])
- {
-#if CONFIG_DEBUG
- if (k >= 16)
- {
- assert(0);
- }
-#endif
- }
-
- mv_contz = vp8_mv_cont(&(vp8_left_bmi(mi, k)->mv.as_mv), &(vp8_above_bmi(mi, k, mis)->mv.as_mv));
-
- switch (bmi.mode = (B_PREDICTION_MODE) sub_mv_ref(bc, vp8_sub_mv_ref_prob2 [mv_contz])) //pc->fc.sub_mv_ref_prob))
- {
- case NEW4X4:
- read_mv(bc, mv, (const MV_CONTEXT *) mvc);
- mv->row += best_mv.row;
- mv->col += best_mv.col;
-#ifdef VPX_MODE_COUNT
- vp8_mv_cont_count[mv_contz][3]++;
-#endif
- break;
- case LEFT4X4:
- *mv = vp8_left_bmi(mi, k)->mv.as_mv;
-#ifdef VPX_MODE_COUNT
- vp8_mv_cont_count[mv_contz][0]++;
-#endif
- break;
- case ABOVE4X4:
- *mv = vp8_above_bmi(mi, k, mis)->mv.as_mv;
-#ifdef VPX_MODE_COUNT
- vp8_mv_cont_count[mv_contz][1]++;
-#endif
- break;
- case ZERO4X4:
- *mv = Zero;
-#ifdef VPX_MODE_COUNT
- vp8_mv_cont_count[mv_contz][2]++;
-#endif
- break;
- default:
- break;
- }
-
- if (mv->col < xd->mb_to_left_edge
- - LEFT_TOP_MARGIN
- || mv->col > xd->mb_to_right_edge
- + RIGHT_BOTTOM_MARGIN
- || mv->row < xd->mb_to_top_edge
- - LEFT_TOP_MARGIN
- || mv->row > xd->mb_to_bottom_edge
- + RIGHT_BOTTOM_MARGIN
- )
- mbmi->need_to_clamp_mvs = 1;
-
- /* Fill (uniform) modes, mvs of jth subset.
- Must do it here because ensuing subsets can
- refer back to us via "left" or "above". */
- do
- if (j == L[k])
- mi->bmi[k] = bmi;
-
- while (++k < 16);
- }
- while (++j < num_p);
- }
-
- *mv = mi->bmi[15].mv.as_mv;
+ /* Fill (uniform) modes, mvs of jth subset.
+ Must do it here because ensuing subsets can
+ refer back to us via "left" or "above". */
+ unsigned char *fill_offset;
+ unsigned int fill_count = vp8_mbsplit_fill_count[s];
- break; /* done with SPLITMV */
+ fill_offset = &vp8_mbsplit_fill_offset[s][(unsigned char)j * vp8_mbsplit_fill_count[s]];
- case NEARMV:
- *mv = nearby;
+ do {
+ mi->bmi[ *fill_offset] = bmi;
+ fill_offset++;
- // Clip "next_nearest" so that it does not extend to far out of image
- if (mv->col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
- mv->col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
- else if (mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
- mv->col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
+ }while (--fill_count);
+ }
- if (mv->row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
- mv->row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
- else if (mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
- mv->row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
+ }
+ while (++j < num_p);
+ }
- goto propagate_mv;
+ *mv = mi->bmi[15].mv.as_mv;
+
+ break; /* done with SPLITMV */
+
+ case NEARMV:
+ *mv = nearby;
+ // Clip "next_nearest" so that it does not extend to far out of image
+ mv->col = (mv->col < mb_to_left_edge) ? mb_to_left_edge : mv->col;
+ mv->col = (mv->col > mb_to_right_edge) ? mb_to_right_edge : mv->col;
+ mv->row = (mv->row < mb_to_top_edge) ? mb_to_top_edge : mv->row;
+ mv->row = (mv->row > mb_to_bottom_edge) ? mb_to_bottom_edge : mv->row;
+ goto propagate_mv;
+
+ case NEARESTMV:
+ *mv = nearest;
+ // Clip "next_nearest" so that it does not extend to far out of image
+ mv->col = (mv->col < mb_to_left_edge) ? mb_to_left_edge : mv->col;
+ mv->col = (mv->col > mb_to_right_edge) ? mb_to_right_edge : mv->col;
+ mv->row = (mv->row < mb_to_top_edge) ? mb_to_top_edge : mv->row;
+ mv->row = (mv->row > mb_to_bottom_edge) ? mb_to_bottom_edge : mv->row;
+ goto propagate_mv;
+
+ case ZEROMV:
+ *mv = Zero;
+ goto propagate_mv;
+
+ case NEWMV:
+ read_mv(bc, mv, (const MV_CONTEXT *) mvc);
+ mv->row += best_mv.row;
+ mv->col += best_mv.col;
+
+ /* Don't need to check this on NEARMV and NEARESTMV modes
+ * since those modes clamp the MV. The NEWMV mode does not,
+ * so signal to the prediction stage whether special
+ * handling may be required.
+ */
+ mbmi->need_to_clamp_mvs = (mv->col < mb_to_left_edge) ? 1 : 0;
+ mbmi->need_to_clamp_mvs |= (mv->col > mb_to_right_edge) ? 1 : 0;
+ mbmi->need_to_clamp_mvs |= (mv->row < mb_to_top_edge) ? 1 : 0;
+ mbmi->need_to_clamp_mvs |= (mv->row > mb_to_bottom_edge) ? 1 : 0;
+
+ propagate_mv: /* same MV throughout */
+ {
+ //int i=0;
+ //do
+ //{
+ // mi->bmi[i].mv.as_mv = *mv;
+ //}
+ //while( ++i < 16);
+
+ mi->bmi[0].mv.as_mv = *mv;
+ mi->bmi[1].mv.as_mv = *mv;
+ mi->bmi[2].mv.as_mv = *mv;
+ mi->bmi[3].mv.as_mv = *mv;
+ mi->bmi[4].mv.as_mv = *mv;
+ mi->bmi[5].mv.as_mv = *mv;
+ mi->bmi[6].mv.as_mv = *mv;
+ mi->bmi[7].mv.as_mv = *mv;
+ mi->bmi[8].mv.as_mv = *mv;
+ mi->bmi[9].mv.as_mv = *mv;
+ mi->bmi[10].mv.as_mv = *mv;
+ mi->bmi[11].mv.as_mv = *mv;
+ mi->bmi[12].mv.as_mv = *mv;
+ mi->bmi[13].mv.as_mv = *mv;
+ mi->bmi[14].mv.as_mv = *mv;
+ mi->bmi[15].mv.as_mv = *mv;
+ }
+ break;
+ default:;
+ #if CONFIG_DEBUG
+ assert(0);
+ #endif
+ }
+ }
+ else
+ {
+ /* MB is intra coded */
+ int j = 0;
+ do
+ {
+ mi->bmi[j].mv.as_mv = Zero;
+ }
+ while (++j < 16);
- case NEARESTMV:
- *mv = nearest;
+ if ((mbmi->mode = (MB_PREDICTION_MODE) vp8_read_ymode(bc, pbi->common.fc.ymode_prob)) == B_PRED)
+ {
+ j = 0;
+ do
+ {
+ mi->bmi[j].mode = (B_PREDICTION_MODE)vp8_read_bmode(bc, pbi->common.fc.bmode_prob);
+ }
+ while (++j < 16);
+ }
- // Clip "next_nearest" so that it does not extend to far out of image
- if (mv->col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
- mv->col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
- else if (mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
- mv->col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
+ mbmi->uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc, pbi->common.fc.uv_mode_prob);
+ }
- if (mv->row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
- mv->row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
- else if (mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
- mv->row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
+}
- goto propagate_mv;
+void vp8_decode_mode_mvs(VP8D_COMP *pbi)
+{
+ MODE_INFO *mi = pbi->common.mi;
+ int mb_row = -1;
- case ZEROMV:
- *mv = Zero;
- goto propagate_mv;
+ vp8_mb_mode_mv_init(pbi);
- case NEWMV:
- read_mv(bc, mv, (const MV_CONTEXT *) mvc);
- mv->row += best_mv.row;
- mv->col += best_mv.col;
+ while (++mb_row < pbi->common.mb_rows)
+ {
+ int mb_col = -1;
+ int mb_to_top_edge;
+ int mb_to_bottom_edge;
- /* Don't need to check this on NEARMV and NEARESTMV modes
- * since those modes clamp the MV. The NEWMV mode does not,
- * so signal to the prediction stage whether special
- * handling may be required.
- */
- if (mv->col < xd->mb_to_left_edge - LEFT_TOP_MARGIN
- || mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN
- || mv->row < xd->mb_to_top_edge - LEFT_TOP_MARGIN
- || mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN
- )
- mbmi->need_to_clamp_mvs = 1;
-
- propagate_mv: /* same MV throughout */
- {
- //int i=0;
- //do
- //{
- // mi->bmi[i].mv.as_mv = *mv;
- //}
- //while( ++i < 16);
-
- mi->bmi[0].mv.as_mv = *mv;
- mi->bmi[1].mv.as_mv = *mv;
- mi->bmi[2].mv.as_mv = *mv;
- mi->bmi[3].mv.as_mv = *mv;
- mi->bmi[4].mv.as_mv = *mv;
- mi->bmi[5].mv.as_mv = *mv;
- mi->bmi[6].mv.as_mv = *mv;
- mi->bmi[7].mv.as_mv = *mv;
- mi->bmi[8].mv.as_mv = *mv;
- mi->bmi[9].mv.as_mv = *mv;
- mi->bmi[10].mv.as_mv = *mv;
- mi->bmi[11].mv.as_mv = *mv;
- mi->bmi[12].mv.as_mv = *mv;
- mi->bmi[13].mv.as_mv = *mv;
- mi->bmi[14].mv.as_mv = *mv;
- mi->bmi[15].mv.as_mv = *mv;
- }
+ pbi->mb.mb_to_top_edge =
+ mb_to_top_edge = -((mb_row * 16)) << 3;
+ mb_to_top_edge -= LEFT_TOP_MARGIN;
- break;
+ pbi->mb.mb_to_bottom_edge =
+ mb_to_bottom_edge = ((pbi->common.mb_rows - 1 - mb_row) * 16) << 3;
+ mb_to_bottom_edge += RIGHT_BOTTOM_MARGIN;
- default:;
-#if CONFIG_DEBUG
- assert(0);
-#endif
- }
- }
+ while (++mb_col < pbi->common.mb_cols)
+ {
+// vp8_read_mb_modes_mv(pbi, xd->mode_info_context, &xd->mode_info_context->mbmi, mb_row, mb_col);
+ if(pbi->common.frame_type == KEY_FRAME)
+ vp8_kfread_modes(pbi, mi, mb_row, mb_col);
else
- {
- /* MB is intra coded */
-
- int j = 0;
-
- do
- {
- mi->bmi[j].mv.as_mv = Zero;
- }
- while (++j < 16);
-
- *mv = Zero;
-
- if ((mbmi->mode = (MB_PREDICTION_MODE) vp8_read_ymode(bc, pc->fc.ymode_prob)) == B_PRED)
- {
- int j = 0;
-
- do
- {
- mi->bmi[j].mode = (B_PREDICTION_MODE)vp8_read_bmode(bc, pc->fc.bmode_prob);
- }
- while (++j < 16);
- }
-
- mbmi->uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc, pc->fc.uv_mode_prob);
- }
+ vp8_read_mb_modes_mv(pbi, mi, &mi->mbmi, mb_row, mb_col);
mi++; // next macroblock
}
@@ -418,3 +553,4 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
mi++; // skip left predictor each row
}
}
+
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index f2d8c766e..4f5b7c7a2 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -23,7 +23,7 @@
#include "quant_common.h"
#include "setupintrarecon.h"
-#include "demode.h"
+
#include "decodemv.h"
#include "extend.h"
#include "vpx_mem/vpx_mem.h"
@@ -151,15 +151,11 @@ static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
/* A version of the above function for chroma block MVs.*/
static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
{
- if (2*mv->col < (xd->mb_to_left_edge - (19 << 3)))
- mv->col = (xd->mb_to_left_edge - (16 << 3)) >> 1;
- else if (2*mv->col > xd->mb_to_right_edge + (18 << 3))
- mv->col = (xd->mb_to_right_edge + (16 << 3)) >> 1;
-
- if (2*mv->row < (xd->mb_to_top_edge - (19 << 3)))
- mv->row = (xd->mb_to_top_edge - (16 << 3)) >> 1;
- else if (2*mv->row > xd->mb_to_bottom_edge + (18 << 3))
- mv->row = (xd->mb_to_bottom_edge + (16 << 3)) >> 1;
+ mv->col = (2*mv->col < (xd->mb_to_left_edge - (19 << 3))) ? (xd->mb_to_left_edge - (16 << 3)) >> 1 : mv->col;
+ mv->col = (2*mv->col > xd->mb_to_right_edge + (18 << 3)) ? (xd->mb_to_right_edge + (16 << 3)) >> 1 : mv->col;
+
+ mv->row = (2*mv->row < (xd->mb_to_top_edge - (19 << 3))) ? (xd->mb_to_top_edge - (16 << 3)) >> 1 : mv->row;
+ mv->row = (2*mv->row > xd->mb_to_bottom_edge + (18 << 3)) ? (xd->mb_to_bottom_edge + (16 << 3)) >> 1 : mv->row;
}
static void clamp_mvs(MACROBLOCKD *xd)
@@ -838,10 +834,8 @@ int vp8_decode_frame(VP8D_COMP *pbi)
// Read the mb_no_coeff_skip flag
pc->mb_no_coeff_skip = (int)vp8_read_bit(bc);
- if (pc->frame_type == KEY_FRAME)
- vp8_kfread_modes(pbi);
- else
- vp8_decode_mode_mvs(pbi);
+
+ vp8_decode_mode_mvs(pbi);
vpx_memset(pc->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * pc->mb_cols);
diff --git a/vp8/decoder/demode.c b/vp8/decoder/demode.c
deleted file mode 100644
index 557508dd8..000000000
--- a/vp8/decoder/demode.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "onyxd_int.h"
-#include "entropymode.h"
-#include "findnearmv.h"
-
-
-int vp8_read_bmode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_bmode_tree, p);
-
- return i;
-}
-
-
-int vp8_read_ymode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_ymode_tree, p);
-
- return i;
-}
-
-int vp8_kfread_ymode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_kf_ymode_tree, p);
-
- return i;
-}
-
-
-
-int vp8_read_uv_mode(vp8_reader *bc, const vp8_prob *p)
-{
- const int i = vp8_treed_read(bc, vp8_uv_mode_tree, p);
-
- return i;
-}
-
-void vp8_read_mb_features(vp8_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *x)
-{
- // Is segmentation enabled
- if (x->segmentation_enabled && x->update_mb_segmentation_map)
- {
- // If so then read the segment id.
- if (vp8_read(r, x->mb_segment_tree_probs[0]))
- mi->segment_id = (unsigned char)(2 + vp8_read(r, x->mb_segment_tree_probs[2]));
- else
- mi->segment_id = (unsigned char)(vp8_read(r, x->mb_segment_tree_probs[1]));
- }
-}
-
-void vp8_kfread_modes(VP8D_COMP *pbi)
-{
- VP8_COMMON *const cp = & pbi->common;
- vp8_reader *const bc = & pbi->bc;
-
- MODE_INFO *m = cp->mi;
- const int ms = cp->mode_info_stride;
-
- int mb_row = -1;
- vp8_prob prob_skip_false = 0;
-
- if (cp->mb_no_coeff_skip)
- prob_skip_false = (vp8_prob)(vp8_read_literal(bc, 8));
-
- while (++mb_row < cp->mb_rows)
- {
- int mb_col = -1;
-
- while (++mb_col < cp->mb_cols)
- {
- MB_PREDICTION_MODE y_mode;
-
- // Read the Macroblock segmentation map if it is being updated explicitly this frame (reset to 0 above by default)
- // By default on a key frame reset all MBs to segment 0
- m->mbmi.segment_id = 0;
-
- if (pbi->mb.update_mb_segmentation_map)
- vp8_read_mb_features(bc, &m->mbmi, &pbi->mb);
-
- // Read the macroblock coeff skip flag if this feature is in use, else default to 0
- if (cp->mb_no_coeff_skip)
- m->mbmi.mb_skip_coeff = vp8_read(bc, prob_skip_false);
- else
- m->mbmi.mb_skip_coeff = 0;
-
- y_mode = (MB_PREDICTION_MODE) vp8_kfread_ymode(bc, cp->kf_ymode_prob);
-
- m->mbmi.ref_frame = INTRA_FRAME;
-
- if ((m->mbmi.mode = y_mode) == B_PRED)
- {
- int i = 0;
-
- do
- {
- const B_PREDICTION_MODE A = vp8_above_bmi(m, i, ms)->mode;
- const B_PREDICTION_MODE L = vp8_left_bmi(m, i)->mode;
-
- m->bmi[i].mode = (B_PREDICTION_MODE) vp8_read_bmode(bc, cp->kf_bmode_prob [A] [L]);
- }
- while (++i < 16);
- }
- else
- {
- int BMode;
- int i = 0;
-
- switch (y_mode)
- {
- case DC_PRED:
- BMode = B_DC_PRED;
- break;
- case V_PRED:
- BMode = B_VE_PRED;
- break;
- case H_PRED:
- BMode = B_HE_PRED;
- break;
- case TM_PRED:
- BMode = B_TM_PRED;
- break;
- default:
- BMode = B_DC_PRED;
- break;
- }
-
- do
- {
- m->bmi[i].mode = (B_PREDICTION_MODE)BMode;
- }
- while (++i < 16);
- }
-
- (m++)->mbmi.uv_mode = (MB_PREDICTION_MODE)vp8_read_uv_mode(bc, cp->kf_uv_mode_prob);
- }
-
- m++; // skip the border
- }
-}
diff --git a/vp8/decoder/demode.h b/vp8/decoder/demode.h
deleted file mode 100644
index a58cff95b..000000000
--- a/vp8/decoder/demode.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "onyxd_int.h"
-
-/* Read (intra) modes for all blocks in a keyframe */
-
-void vp8_kfread_modes(VP8D_COMP *pbi);
-
-/* Intra mode for a Y subblock */
-
-int vp8_read_bmode(vp8_reader *, const vp8_prob *);
-
-/* MB intra Y mode trees differ for key and inter frames. */
-
-int vp8_read_ymode(vp8_reader *, const vp8_prob *);
-int vp8_kfread_ymode(vp8_reader *, const vp8_prob *);
-
-/* MB intra UV mode trees are the same for key and inter frames. */
-
-int vp8_read_uv_mode(vp8_reader *, const vp8_prob *);
-
-/* Read any macroblock-level features that may be present. */
-
-void vp8_read_mb_features(vp8_reader *, MB_MODE_INFO *, MACROBLOCKD *);
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index 9be4d47b2..ad21ae3f5 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -125,6 +125,12 @@ typedef struct VP8Decompressor
struct vp8_dboolhuff_rtcd_vtable dboolhuff;
#endif
+
+ vp8_prob prob_intra;
+ vp8_prob prob_last;
+ vp8_prob prob_gf;
+ vp8_prob prob_skip_false;
+
} VP8D_COMP;
int vp8_decode_frame(VP8D_COMP *cpi);
diff --git a/vp8/decoder/xprintf.c b/vp8/decoder/xprintf.c
deleted file mode 100644
index e3b953ef3..000000000
--- a/vp8/decoder/xprintf.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
-*
-* Module Title : xprintf.cpp
-*
-* Description : Display a printf style message on the current video frame.
-*
-****************************************************************************/
-
-/****************************************************************************
-* Header Files
-****************************************************************************/
-
-#include <stdio.h>
-#include <stdarg.h>
-#ifdef _WIN32_WCE
-#include <windows.h>
-#endif
-#include "xprintf.h"
-
-/****************************************************************************
- *
- * ROUTINE : xprintf
- *
- * INPUTS : const PB_INSTANCE *ppbi : Pointer to decoder instance.
- * long n_pixel : Offset into buffer to write text.
- * const char *format : Format string for print.
- * ... : Variable length argument list.
- *
- * OUTPUTS : None.
- *
- * RETURNS : int: Size (in bytes) of the formatted text.
- *
- * FUNCTION : Display a printf style message on the current video frame.
- *
- * SPECIAL NOTES : None.
- *
- ****************************************************************************/
-int onyx_xprintf(unsigned char *ppbuffer, long n_pixel, long n_size, long n_stride, const char *format, ...)
-{
- BOOL b_rc;
- va_list arglist;
- HFONT hfont, hfonto;
-
- int rc = 0;
- char sz_formatted[256] = "";
- unsigned char *p_dest = &ppbuffer[n_pixel];
-
-#ifdef _WIN32_WCE
- // Set up temporary bitmap
- HDC hdc_memory = NULL;
- HBITMAP hbm_temp = NULL;
- HBITMAP hbm_orig = NULL;
-
- RECT rect;
-
- // Copy bitmap to video frame
- long x;
- long y;
-
- // Format text
- va_start(arglist, format);
- _vsnprintf(sz_formatted, sizeof(sz_formatted), format, arglist);
- va_end(arglist);
-
- rect.left = 0;
- rect.top = 0;
- rect.right = 8 * strlen(sz_formatted);
- rect.bottom = 8;
-
- hdc_memory = create_compatible_dc(NULL);
-
- if (hdc_memory == NULL)
- goto Exit;
-
- hbm_temp = create_bitmap(rect.right, rect.bottom, 1, 1, NULL);
-
- if (hbm_temp == NULL)
- goto Exit;
-
- hbm_orig = (HBITMAP)(select_object(hdc_memory, hbm_temp));
-
- if (!hbm_orig)
- goto Exit;
-
- // Write text into bitmap
- // font?
- hfont = create_font(8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, VARIABLE_PITCH | FF_SWISS, "");
-
- if (hfont == NULL)
- goto Exit;
-
- hfonto = (HFONT)(select_object(hdc_memory, hbm_temp));
-
- if (!hfonto)
- goto Exit;
-
- select_object(hdc_memory, hfont);
- set_text_color(hdc_memory, 1);
- set_bk_color(hdc_memory, 0);
- set_bk_mode(hdc_memory, TRANSPARENT);
-
- b_rc = bit_blt(hdc_memory, rect.left, rect.top, rect.right, rect.bottom, hdc_memory, rect.left, rect.top, BLACKNESS);
-
- if (!b_rc)
- goto Exit;
-
- b_rc = ext_text_out(hdc_memory, 0, 0, ETO_CLIPPED, &rect, sz_formatted, strlen(sz_formatted), NULL);
-
- if (!b_rc)
- goto Exit;
-
- for (y = rect.top; y < rect.bottom; ++y)
- {
- for (x = rect.left; x < rect.right; ++x)
- {
- if (get_pixel(hdc_memory, x, rect.bottom - 1 - y))
- p_dest[x] = 255;
- }
-
- p_dest += n_stride;
- }
-
- rc = strlen(sz_formatted);
-
-Exit:
-
- if (hbm_temp != NULL)
- {
- if (hbm_orig != NULL)
- {
- select_object(hdc_memory, hbm_orig);
- }
-
- delete_object(hbm_temp);
- }
-
- if (hfont != NULL)
- {
- if (hfonto != NULL)
- select_object(hdc_memory, hfonto);
-
- delete_object(hfont);
- }
-
- if (hdc_memory != NULL)
- delete_dc(hdc_memory);
-
- hdc_memory = 0;
-
-#endif
-
- return rc;
-}
diff --git a/vp8/decoder/xprintf.h b/vp8/decoder/xprintf.h
deleted file mode 100644
index f83dd39c6..000000000
--- a/vp8/decoder/xprintf.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
-*
-* Module Title : xprintf.h
-*
-* Description : Debug print interface header file.
-*
-****************************************************************************/
-#ifndef __INC_XPRINTF_H
-#define __INC_XPRINTF_H
-
-/****************************************************************************
-* Header Files
-****************************************************************************/
-
-/****************************************************************************
-* Functions
-****************************************************************************/
-
-// Display a printf style message on the current video frame
-extern int onyx_xprintf(unsigned char *ppbuffer, long n_pixel, long n_size, long n_stride, const char *format, ...);
-
-#endif
diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
index d9b8d36fd..0e86f28df 100644
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -26,8 +26,8 @@ _int64 context_counters[BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [vp8_coef
void vp8_stuff_mb(VP8_COMP *cpi, MACROBLOCKD *x, TOKENEXTRA **t) ;
void vp8_fix_contexts(MACROBLOCKD *x);
-TOKENEXTRA vp8_dct_value_tokens[DCT_MAX_VALUE*2];
-const TOKENEXTRA *vp8_dct_value_tokens_ptr;
+TOKENVALUE vp8_dct_value_tokens[DCT_MAX_VALUE*2];
+const TOKENVALUE *vp8_dct_value_tokens_ptr;
int vp8_dct_value_cost[DCT_MAX_VALUE*2];
const int *vp8_dct_value_cost_ptr;
#if 0
@@ -37,7 +37,7 @@ int skip_false_count = 0;
static void fill_value_tokens()
{
- TOKENEXTRA *const t = vp8_dct_value_tokens + DCT_MAX_VALUE;
+ TOKENVALUE *const t = vp8_dct_value_tokens + DCT_MAX_VALUE;
vp8_extra_bit_struct *const e = vp8_extra_bits;
int i = -DCT_MAX_VALUE;
diff --git a/vp8/encoder/tokenize.h b/vp8/encoder/tokenize.h
index 7b9fc9eaa..01e8ec6d7 100644
--- a/vp8/encoder/tokenize.h
+++ b/vp8/encoder/tokenize.h
@@ -19,6 +19,12 @@ void vp8_tokenize_initialize();
typedef struct
{
+ short Token;
+ short Extra;
+} TOKENVALUE;
+
+typedef struct
+{
int Token;
int Extra;
const vp8_prob *context_tree;
@@ -40,6 +46,6 @@ extern const int *vp8_dct_value_cost_ptr;
* improve cache locality, since it's needed for costing when the rest of the
* fields are not.
*/
-extern const TOKENEXTRA *vp8_dct_value_tokens_ptr;
+extern const TOKENVALUE *vp8_dct_value_tokens_ptr;
#endif /* tokenize_h */
diff --git a/vp8/vp8dx.mk b/vp8/vp8dx.mk
index 1d2558f23..941961708 100644
--- a/vp8/vp8dx.mk
+++ b/vp8/vp8dx.mk
@@ -54,14 +54,12 @@ CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)decoder
VP8_DX_SRCS-yes += decoder/dboolhuff.c
VP8_DX_SRCS-yes += decoder/decodemv.c
VP8_DX_SRCS-yes += decoder/decodframe.c
-VP8_DX_SRCS-yes += decoder/demode.c
VP8_DX_SRCS-yes += decoder/dequantize.c
VP8_DX_SRCS-yes += decoder/detokenize.c
VP8_DX_SRCS-yes += decoder/generic/dsystemdependent.c
VP8_DX_SRCS-yes += decoder/dboolhuff.h
VP8_DX_SRCS-yes += decoder/decodemv.h
VP8_DX_SRCS-yes += decoder/decoderthreading.h
-VP8_DX_SRCS-yes += decoder/demode.h
VP8_DX_SRCS-yes += decoder/dequantize.h
VP8_DX_SRCS-yes += decoder/detokenize.h
VP8_DX_SRCS-yes += decoder/onyxd_int.h