Compare commits
543 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b9ce430292 | ||
![]() |
feba090e5f | ||
![]() |
a1d929ea97 | ||
![]() |
7a09f6b892 | ||
![]() |
fd671152bc | ||
![]() |
57e12be283 | ||
![]() |
a0ad16e203 | ||
![]() |
2cd48bdc92 | ||
![]() |
cc91d655e4 | ||
![]() |
74efda4bd6 | ||
![]() |
3a19eebe4d | ||
![]() |
000c8414b5 | ||
![]() |
bc10eab41b | ||
![]() |
ef2248a2a3 | ||
![]() |
9a3de881c0 | ||
![]() |
f2b36a4de7 | ||
![]() |
bfca084fcd | ||
![]() |
9961ad479a | ||
![]() |
7891fb5eda | ||
![]() |
836f8e9883 | ||
![]() |
9bc8d5aab9 | ||
![]() |
eebb648380 | ||
![]() |
d034bfa947 | ||
![]() |
464b1df6d4 | ||
![]() |
6b1d95d6d8 | ||
![]() |
efb2f92702 | ||
![]() |
9cc6f078dc | ||
![]() |
17718fbbcd | ||
![]() |
0d80584327 | ||
![]() |
b52288aaff | ||
![]() |
8bb82fded5 | ||
![]() |
6475224e4f | ||
![]() |
999f31f71c | ||
![]() |
7c7801e34d | ||
![]() |
a5ffcdd8d4 | ||
![]() |
cd7f6841aa | ||
![]() |
83e8f2f976 | ||
![]() |
7ebcaeb0fa | ||
![]() |
4d9791e2b1 | ||
![]() |
69d074841d | ||
![]() |
80fe4723d2 | ||
![]() |
fe91e47bc7 | ||
![]() |
0a3eec86e5 | ||
![]() |
78bf8284cf | ||
![]() |
ee28bb87b4 | ||
![]() |
01824d1848 | ||
![]() |
95390b2b20 | ||
![]() |
03c0af8747 | ||
![]() |
7ee44eef13 | ||
![]() |
ca003fbb22 | ||
![]() |
9016fa22e0 | ||
![]() |
3c8007f19e | ||
![]() |
3b783d2217 | ||
![]() |
9e06601db6 | ||
![]() |
b0e1c5f899 | ||
![]() |
8a6a7ae292 | ||
![]() |
533470c998 | ||
![]() |
65d73881f7 | ||
![]() |
1fc3cc8e97 | ||
![]() |
96e5939faf | ||
![]() |
6106b72eb6 | ||
![]() |
fd3078fd8f | ||
![]() |
5ed84c2fdf | ||
![]() |
861a6bbbfd | ||
![]() |
adaf77c075 | ||
![]() |
15dffcfefa | ||
![]() |
4cf4c94ad1 | ||
![]() |
9da8a34437 | ||
![]() |
52bddd44c0 | ||
![]() |
f6886c4b93 | ||
![]() |
ec658125b0 | ||
![]() |
d21070a538 | ||
![]() |
81fd7ac589 | ||
![]() |
4de7aed6fb | ||
![]() |
8b698e8cb1 | ||
![]() |
107f14bcf9 | ||
![]() |
4c53bacce4 | ||
![]() |
30d8ba541e | ||
![]() |
55cff377dd | ||
![]() |
1a89bc04e8 | ||
![]() |
eb8e9f80c4 | ||
![]() |
85b27a1271 | ||
![]() |
cc017ca8df | ||
![]() |
0e213fb999 | ||
![]() |
e6109dbd41 | ||
![]() |
4206c6dd01 | ||
![]() |
f199bab7ab | ||
![]() |
7ca59827e3 | ||
![]() |
30f58b526d | ||
![]() |
9bbab8e457 | ||
![]() |
ea90cee2a9 | ||
![]() |
6f35b1958e | ||
![]() |
9704cdec9f | ||
![]() |
d539c1db5a | ||
![]() |
96f706655e | ||
![]() |
3730963073 | ||
![]() |
d377580d07 | ||
![]() |
d9ed9f9dae | ||
![]() |
ab98103fac | ||
![]() |
a75a9cf2fd | ||
![]() |
eb492100cd | ||
![]() |
4e72915ebc | ||
![]() |
f4316f39a1 | ||
![]() |
0211cd899a | ||
![]() |
22141d9d79 | ||
![]() |
b501251e2e | ||
![]() |
5979b89b92 | ||
![]() |
c03cc3a85e | ||
![]() |
e278673c8e | ||
![]() |
154f1c2234 | ||
![]() |
eec08d5cfc | ||
![]() |
57c7e45066 | ||
![]() |
1338a98d07 | ||
![]() |
1076101b2b | ||
![]() |
33d91719d0 | ||
![]() |
0925442e66 | ||
![]() |
a082467891 | ||
![]() |
260f5071ed | ||
![]() |
648cfcb437 | ||
![]() |
08cf9faed0 | ||
![]() |
7b7ca65bfc | ||
![]() |
8d02833a61 | ||
![]() |
818b10396d | ||
![]() |
2ff6d35064 | ||
![]() |
488ba1ab9c | ||
![]() |
c6fd0a5dd6 | ||
![]() |
7e9a519fbb | ||
![]() |
64075c9b01 | ||
![]() |
c953aeacd4 | ||
![]() |
90625c3bc1 | ||
![]() |
10f8b36146 | ||
![]() |
7177c3220c | ||
![]() |
446d85e4d7 | ||
![]() |
c533f2a43e | ||
![]() |
5746a76145 | ||
![]() |
c522217d78 | ||
![]() |
e75e249b75 | ||
![]() |
2a96d6b0d5 | ||
![]() |
24c346dffc | ||
![]() |
8bec177dc4 | ||
![]() |
f0b500bc4f | ||
![]() |
e8d58d3fd0 | ||
![]() |
cdb2a126a6 | ||
![]() |
fa0f418523 | ||
![]() |
bd6ffaa325 | ||
![]() |
272974af36 | ||
![]() |
12ddb75a9a | ||
![]() |
e57394aa1d | ||
![]() |
6cb50ce527 | ||
![]() |
8ee88da060 | ||
![]() |
b0cfcb2ca8 | ||
![]() |
1829d03906 | ||
![]() |
9f0b42247d | ||
![]() |
985f09fdca | ||
![]() |
d71ba03822 | ||
![]() |
97fd7c5eb6 | ||
![]() |
2b59e14a00 | ||
![]() |
d1b6fa4161 | ||
![]() |
b4ab43f12c | ||
![]() |
ff61cbc510 | ||
![]() |
4180dfd93c | ||
![]() |
ec52713999 | ||
![]() |
429743c56b | ||
![]() |
51ebb9a396 | ||
![]() |
3c37e7d2fa | ||
![]() |
336ca9a43a | ||
![]() |
aa165c8c5d | ||
![]() |
a9a1eac6c7 | ||
![]() |
69babd39f1 | ||
![]() |
b78d90703c | ||
![]() |
4b0b43632b | ||
![]() |
0e17ee56e8 | ||
![]() |
6ce58e84d3 | ||
![]() |
1746b2adc6 | ||
![]() |
a497cb59cd | ||
![]() |
41aede61e9 | ||
![]() |
a82c58c40f | ||
![]() |
3c208a5a5e | ||
![]() |
03b3fcecac | ||
![]() |
cbc249ba00 | ||
![]() |
1347b2ce0f | ||
![]() |
d4d7589428 | ||
![]() |
f47544745e | ||
![]() |
ef4a9670a8 | ||
![]() |
1161055129 | ||
![]() |
aa4f9dd153 | ||
![]() |
6b8665ebc4 | ||
![]() |
e66e9ddfb4 | ||
![]() |
0cdc046ff2 | ||
![]() |
dd0100ddb1 | ||
![]() |
e593014ebd | ||
![]() |
4066c8b205 | ||
![]() |
fbea897d85 | ||
![]() |
8967fcaf84 | ||
![]() |
980ca6324f | ||
![]() |
fce8f063e3 | ||
![]() |
5215c8f066 | ||
![]() |
310666b1cd | ||
![]() |
9f89c4c291 | ||
![]() |
903efe8a2f | ||
![]() |
fe8b1e51f4 | ||
![]() |
9ec2552792 | ||
![]() |
e3e63fbcba | ||
![]() |
c0e80959ce | ||
![]() |
a9cb6f6918 | ||
![]() |
210fa2810a | ||
![]() |
de6ddefa9f | ||
![]() |
f31c40086e | ||
![]() |
7f009975e9 | ||
![]() |
4d3c3be6ba | ||
![]() |
a6f4fc5a93 | ||
![]() |
827e22c732 | ||
![]() |
3eb4143fc3 | ||
![]() |
a591209afd | ||
![]() |
606ac45b2f | ||
![]() |
b25ebf7dde | ||
![]() |
94285b79ab | ||
![]() |
07ff7fa811 | ||
![]() |
e61573c5f4 | ||
![]() |
bb3d510a18 | ||
![]() |
15296c24a6 | ||
![]() |
eab09e34e3 | ||
![]() |
cdc35037a5 | ||
![]() |
147e864629 | ||
![]() |
b293698561 | ||
![]() |
acd147c50c | ||
![]() |
e7bbedce5f | ||
![]() |
e2c5e78ad9 | ||
![]() |
31fd98d724 | ||
![]() |
e859faa29e | ||
![]() |
532faf0f1c | ||
![]() |
6c86ef2ea4 | ||
![]() |
d67acd870a | ||
![]() |
4e06b0c602 | ||
![]() |
a441b60aa0 | ||
![]() |
96b6b6bbf0 | ||
![]() |
a87fb0da5b | ||
![]() |
3cecdd683e | ||
![]() |
1a376c407a | ||
![]() |
17b34a1bba | ||
![]() |
3897b48aba | ||
![]() |
c8c71f1fbf | ||
![]() |
007486329f | ||
![]() |
c7acd6db5e | ||
![]() |
6fc1d9efc4 | ||
![]() |
6291dd4c2f | ||
![]() |
d6e80deb32 | ||
![]() |
7c32cb52b5 | ||
![]() |
5daaa838a6 | ||
![]() |
b178fe7bfb | ||
![]() |
5eaa9bcfe3 | ||
![]() |
0277c70a17 | ||
![]() |
576629baaf | ||
![]() |
8df79e9d42 | ||
![]() |
7b0b6a2c41 | ||
![]() |
0ca0c4f6a0 | ||
![]() |
0164a1cc5b | ||
![]() |
30fb976e3e | ||
![]() |
52ec78be7d | ||
![]() |
598759be1d | ||
![]() |
71618e542c | ||
![]() |
118b9931d7 | ||
![]() |
538c6ea3d3 | ||
![]() |
53d92e61cc | ||
![]() |
9904c28f5b | ||
![]() |
baedcedcbe | ||
![]() |
5d0174bc02 | ||
![]() |
363a67c601 | ||
![]() |
5205d299bb | ||
![]() |
2926571be6 | ||
![]() |
e343988f9d | ||
![]() |
965d8686bb | ||
![]() |
2b10528adc | ||
![]() |
c8a88a7642 | ||
![]() |
0d3f31e83a | ||
![]() |
7f63bfa6d2 | ||
![]() |
cab6ac16e0 | ||
![]() |
b073e3cdd4 | ||
![]() |
cd0bf0e407 | ||
![]() |
0927a41139 | ||
![]() |
7fccab39b5 | ||
![]() |
dd6134b472 | ||
![]() |
fc2fc899ae | ||
![]() |
f78e5a04e6 | ||
![]() |
5715c39cf8 | ||
![]() |
d7f26e13fe | ||
![]() |
d850034443 | ||
![]() |
ffe79d61d4 | ||
![]() |
9ec20f85c4 | ||
![]() |
caf0f14f84 | ||
![]() |
d708e7fbbe | ||
![]() |
d790bc1779 | ||
![]() |
2fb29ff7f9 | ||
![]() |
57faddb7c5 | ||
![]() |
49f7f05f52 | ||
![]() |
5e39a8c16f | ||
![]() |
0f7e4665ae | ||
![]() |
4890853010 | ||
![]() |
410ae576e7 | ||
![]() |
a419f0f232 | ||
![]() |
cf0970157d | ||
![]() |
ad479a9b3d | ||
![]() |
ea392d4714 | ||
![]() |
b9180fc049 | ||
![]() |
2d225689d3 | ||
![]() |
2bf62c1dbb | ||
![]() |
e82d261d10 | ||
![]() |
8631c1b8a2 | ||
![]() |
eb5b965b44 | ||
![]() |
600875cd6a | ||
![]() |
0fe79aab19 | ||
![]() |
38ddb426d0 | ||
![]() |
c1b417c6ba | ||
![]() |
282b58006b | ||
![]() |
1e1799c9cb | ||
![]() |
4853e5fb1b | ||
![]() |
65dd157c3c | ||
![]() |
51fe9168d5 | ||
![]() |
eec30c891d | ||
![]() |
871bd23e4c | ||
![]() |
92963df086 | ||
![]() |
44d35f7b25 | ||
![]() |
c7ca380832 | ||
![]() |
297dc90255 | ||
![]() |
499510f2be | ||
![]() |
2d6cb342c2 | ||
![]() |
c8f4c187b3 | ||
![]() |
9851486b2f | ||
![]() |
6f3d7ecc66 | ||
![]() |
14d827f44e | ||
![]() |
22f56b93e5 | ||
![]() |
3e32105d63 | ||
![]() |
2bf8fb5889 | ||
![]() |
f039a85fd8 | ||
![]() |
f86993f195 | ||
![]() |
357800e7cd | ||
![]() |
9f9cc8fe71 | ||
![]() |
ef8ba4f668 | ||
![]() |
9260aa8e15 | ||
![]() |
25a36d6b3c | ||
![]() |
d8216b19b6 | ||
![]() |
d46ddd0839 | ||
![]() |
0cc044f071 | ||
![]() |
8b1a14d12f | ||
![]() |
e50c842755 | ||
![]() |
22ae1403e9 | ||
![]() |
28f5451572 | ||
![]() |
14c9fce8e4 | ||
![]() |
f2a6799cc9 | ||
![]() |
e918ed98d4 | ||
![]() |
e5cef5d5a6 | ||
![]() |
faed00d844 | ||
![]() |
101c2bd1fa | ||
![]() |
414b5eaede | ||
![]() |
3f252e30e4 | ||
![]() |
f0605f4b7e | ||
![]() |
60b36abf85 | ||
![]() |
24e7b1b90d | ||
![]() |
061a16d96e | ||
![]() |
1b27e93cd1 | ||
![]() |
3939e85b26 | ||
![]() |
0c483d6b68 | ||
![]() |
dba053898a | ||
![]() |
504601bb14 | ||
![]() |
b41c17d625 | ||
![]() |
11876faa11 | ||
![]() |
88e4a8af0f | ||
![]() |
175495fe73 | ||
![]() |
f4126995b7 | ||
![]() |
a7eea3e267 | ||
![]() |
d72c536ede | ||
![]() |
8e858f90f3 | ||
![]() |
abf1784c31 | ||
![]() |
317d4244cb | ||
![]() |
c311b3b3a9 | ||
![]() |
5948a02106 | ||
![]() |
441cac8ea6 | ||
![]() |
97495c5c5c | ||
![]() |
b35a0db0e7 | ||
![]() |
a91b42f022 | ||
![]() |
21173e1999 | ||
![]() |
b5b61c179d | ||
![]() |
0c261715b0 | ||
![]() |
3c5ed6f52e | ||
![]() |
6dc21bce63 | ||
![]() |
87b12ac875 | ||
![]() |
72b7db36f3 | ||
![]() |
e0a80519c7 | ||
![]() |
46da1cae05 | ||
![]() |
e4dc2b9248 | ||
![]() |
6b33ca395f | ||
![]() |
9aa58f3fcb | ||
![]() |
d9ca52452b | ||
![]() |
8106df8f5a | ||
![]() |
c459d37c26 | ||
![]() |
811d0ff209 | ||
![]() |
21ac3c8f26 | ||
![]() |
4ed05a8bb1 | ||
![]() |
00794a93ec | ||
![]() |
8b15cf6929 | ||
![]() |
3df4436e1a | ||
![]() |
a46ec16569 | ||
![]() |
3f8349467a | ||
![]() |
31322c5faa | ||
![]() |
a337725625 | ||
![]() |
b3151c80fc | ||
![]() |
0799cccce3 | ||
![]() |
c88fc5b2f9 | ||
![]() |
cb265a497d | ||
![]() |
ccea000c4b | ||
![]() |
403966ae00 | ||
![]() |
bf2c903000 | ||
![]() |
85ef83a173 | ||
![]() |
1991123054 | ||
![]() |
9e9f5f3d70 | ||
![]() |
06dc2f6166 | ||
![]() |
66ba79f5fb | ||
![]() |
fd9df44a05 | ||
![]() |
3c021e1d79 | ||
![]() |
451ab0c01e | ||
![]() |
bcee56bed5 | ||
![]() |
921ffdd2c9 | ||
![]() |
9ed1b2f09e | ||
![]() |
6a819ce4fe | ||
![]() |
56e8485c84 | ||
![]() |
a05bf133ae | ||
![]() |
e68953b7c8 | ||
![]() |
9aa2bd8a03 | ||
![]() |
6b7cf3077d | ||
![]() |
eb0c5a6ffc | ||
![]() |
422f97d7ab | ||
![]() |
7af4eb014b | ||
![]() |
20cd3e6b8f | ||
![]() |
6b66c01c88 | ||
![]() |
9c41143d66 | ||
![]() |
e9cacfd66d | ||
![]() |
301409107f | ||
![]() |
ddf94f6184 | ||
![]() |
c21f53a501 | ||
![]() |
7a1590713e | ||
![]() |
9ed874713f | ||
![]() |
676610d2a8 | ||
![]() |
fd903902ef | ||
![]() |
154b4b4196 | ||
![]() |
953c6a011e | ||
![]() |
e50f96a4a3 | ||
![]() |
5d88a82aa0 | ||
![]() |
cbcfbe1b29 | ||
![]() |
888699091d | ||
![]() |
87c40b35eb | ||
![]() |
a6f538cefa | ||
![]() |
a60461a340 | ||
![]() |
f0f609c2e2 | ||
![]() |
91b5c98b3d | ||
![]() |
8d07a97acc | ||
![]() |
6d84322762 | ||
![]() |
c34d91a84e | ||
![]() |
aabae97e57 | ||
![]() |
52cf4dcaea | ||
![]() |
b8fa2839a2 | ||
![]() |
2578b767c3 | ||
![]() |
ce328b855f | ||
![]() |
aab70f4d7a | ||
![]() |
bcba86e2e9 | ||
![]() |
9a4052a4ec | ||
![]() |
b1bfd0ba87 | ||
![]() |
019384f2d3 | ||
![]() |
e2c6b05f9a | ||
![]() |
61c5e31ca1 | ||
![]() |
ad1216151d | ||
![]() |
02a31e6b3c | ||
![]() |
84be08b07f | ||
![]() |
313bfbb6a2 | ||
![]() |
2089f26b08 | ||
![]() |
507ee87e3e | ||
![]() |
f2bd11faa4 | ||
![]() |
0c1cec2205 | ||
![]() |
dadc9189ed | ||
![]() |
f05feab7b9 | ||
![]() |
02360dd2c2 | ||
![]() |
b0a12a2880 | ||
![]() |
b5ce9456db | ||
![]() |
e6047a17a9 | ||
![]() |
f93b1e7be1 | ||
![]() |
04b9e0d787 | ||
![]() |
ce42e79abc | ||
![]() |
565d0e6feb | ||
![]() |
6b151d436d | ||
![]() |
5f0b303c28 | ||
![]() |
3653fb473a | ||
![]() |
9e50ed7f27 | ||
![]() |
732cb9a643 | ||
![]() |
c535025c12 | ||
![]() |
e8223bd250 | ||
![]() |
7989bb7fe7 | ||
![]() |
6776bd62b5 | ||
![]() |
a5879f7c81 | ||
![]() |
12ee845ee7 | ||
![]() |
d02e74a073 | ||
![]() |
78071b3b97 | ||
![]() |
efd54f8f41 | ||
![]() |
8144132866 | ||
![]() |
e6df50031e | ||
![]() |
169823428f | ||
![]() |
12d45f62f6 | ||
![]() |
8c50a70a95 | ||
![]() |
768ae275dc | ||
![]() |
fea3556e20 | ||
![]() |
2e0d55314c | ||
![]() |
2dad8d65d9 | ||
![]() |
51acb01167 | ||
![]() |
417b852967 | ||
![]() |
45f4b87e8e | ||
![]() |
9df0d29823 | ||
![]() |
a040eb37e4 | ||
![]() |
fa1a9290e6 | ||
![]() |
d8ebdcd89d | ||
![]() |
11c706488b | ||
![]() |
e2000cc5ca | ||
![]() |
07c6eb18ad | ||
![]() |
749bc98618 | ||
![]() |
57d459ba82 | ||
![]() |
8aae246089 | ||
![]() |
109b69a706 | ||
![]() |
0b0bc8d098 | ||
![]() |
be8af188d0 | ||
![]() |
61311e6103 | ||
![]() |
510e0ab467 | ||
![]() |
83a91e789c | ||
![]() |
f103dcefaf | ||
![]() |
2a8f57f50d | ||
![]() |
fdb61a4531 | ||
![]() |
ab77b4e898 | ||
![]() |
55f74c59c7 | ||
![]() |
a910049aea | ||
![]() |
57cc35dd60 | ||
![]() |
9951f46133 | ||
![]() |
8978358358 | ||
![]() |
319f7c4d56 | ||
![]() |
294aa37745 | ||
![]() |
c14754be1d | ||
![]() |
8a6af9f98f | ||
![]() |
892102842a |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -32,6 +32,8 @@
|
||||
/ivfdec.dox
|
||||
/ivfenc
|
||||
/ivfenc.dox
|
||||
/libvpx.so*
|
||||
/libvpx.ver
|
||||
/obj_int_extract
|
||||
/postproc
|
||||
/postproc.c
|
||||
@@ -43,6 +45,7 @@
|
||||
/simple_encoder
|
||||
/simple_encoder.c
|
||||
/simple_encoder.dox
|
||||
/test_libvpx
|
||||
/twopass_encoder
|
||||
/twopass_encoder.c
|
||||
/twopass_encoder.dox
|
||||
@@ -55,7 +58,14 @@
|
||||
/vp8cx_set_ref
|
||||
/vp8cx_set_ref.c
|
||||
/vp8cx_set_ref.dox
|
||||
/vpx.pc
|
||||
/vpx_config.c
|
||||
/vpx_config.h
|
||||
/vpx_rtcd.h
|
||||
/vpx_version.h
|
||||
/vpxdec
|
||||
/vpxenc
|
||||
TAGS
|
||||
.cproject
|
||||
.project
|
||||
.settings
|
||||
|
1
.mailmap
1
.mailmap
@@ -5,3 +5,4 @@ Tom Finegan <tomfinegan@google.com>
|
||||
Ralph Giles <giles@xiph.org> <giles@entropywave.com>
|
||||
Ralph Giles <giles@xiph.org> <giles@mozilla.com>
|
||||
Alpha Lam <hclam@google.com> <hclam@chromium.org>
|
||||
Deb Mukherjee <debargha@google.com>
|
||||
|
4
AUTHORS
4
AUTHORS
@@ -31,9 +31,11 @@ John Koleszar <jkoleszar@google.com>
|
||||
Joshua Bleecher Snyder <josh@treelinelabs.com>
|
||||
Justin Clift <justin@salasaga.org>
|
||||
Justin Lebar <justin.lebar@gmail.com>
|
||||
KO Myung-Hun <komh@chollian.net>
|
||||
Lou Quillio <louquillio@google.com>
|
||||
Luca Barbato <lu_zero@gentoo.org>
|
||||
Makoto Kato <makoto.kt@gmail.com>
|
||||
Marco Paniconi <marpan@google.com>
|
||||
Martin Ettl <ettl.martin78@googlemail.com>
|
||||
Michael Kohler <michaelkohler@live.com>
|
||||
Mike Hommey <mhommey@mozilla.com>
|
||||
@@ -43,6 +45,7 @@ Patrik Westin <patrik.westin@gmail.com>
|
||||
Paul Wilkins <paulwilkins@google.com>
|
||||
Pavol Rusnak <stick@gk2.sk>
|
||||
Philip Jägenstedt <philipj@opera.com>
|
||||
Priit Laes <plaes@plaes.org>
|
||||
Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
|
||||
Rafaël Carré <funman@videolan.org>
|
||||
Ralph Giles <giles@xiph.org>
|
||||
@@ -50,6 +53,7 @@ Ronald S. Bultje <rbultje@google.com>
|
||||
Scott LaVarnway <slavarnway@google.com>
|
||||
Stefan Holmer <holmer@google.com>
|
||||
Taekhyun Kim <takim@nvidia.com>
|
||||
Takanori MATSUURA <t.matsuu@gmail.com>
|
||||
Tero Rintaluoma <teror@google.com>
|
||||
Thijs Vermeir <thijsvermeir@gmail.com>
|
||||
Timothy B. Terriberry <tterribe@xiph.org>
|
||||
|
121
CHANGELOG
121
CHANGELOG
@@ -1,3 +1,124 @@
|
||||
2012-12-21 v1.2.0
|
||||
This release acts as a checkpoint for a large amount of internal refactoring
|
||||
and testing. It also contains a number of small bugfixes, so all users are
|
||||
encouraged to upgrade.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI and API compatible with Duclair (v1.0.0). Users
|
||||
of older releases should refer to the Upgrading notes in this
|
||||
document for that release.
|
||||
|
||||
- Enhancements:
|
||||
VP8 optimizations for MIPS dspr2
|
||||
vpxenc: add -quiet option
|
||||
|
||||
- Speed:
|
||||
Encoder and decoder speed is consistent with the Eider release.
|
||||
|
||||
- Quality:
|
||||
In general, quality is consistent with the Eider release.
|
||||
|
||||
Minor tweaks to ARNR filtering
|
||||
Minor improvements to real time encoding with multiple temporal layers
|
||||
|
||||
- Bug Fixes:
|
||||
Fixes multithreaded encoder race condition in loopfilter
|
||||
Fixes multi-resolution threaded encoding
|
||||
Fix potential encoder dead-lock after picture resize
|
||||
|
||||
|
||||
2012-05-09 v1.1.0 "Eider"
|
||||
This introduces a number of enhancements, mostly focused on real-time
|
||||
encoding. In addition, it fixes a decoder bug (first introduced in
|
||||
Duclair) so all users of that release are encouraged to upgrade.
|
||||
|
||||
- Upgrading:
|
||||
This release is ABI and API compatible with Duclair (v1.0.0). Users
|
||||
of older releases should refer to the Upgrading notes in this
|
||||
document for that release.
|
||||
|
||||
This release introduces a new temporal denoiser, controlled by the
|
||||
VP8E_SET_NOISE_SENSITIVITY control. The temporal denoiser does not
|
||||
currently take a strength parameter, so the control is effectively
|
||||
a boolean - zero (off) or non-zero (on). For compatibility with
|
||||
existing applications, the values accepted are the same as those
|
||||
for the spatial denoiser (0-6). The temporal denoiser is enabled
|
||||
by default, and the older spatial denoiser may be restored by
|
||||
configuring with --disable-temporal-denoising. The temporal denoiser
|
||||
is more computationally intensive than the spatial one.
|
||||
|
||||
This release removes support for a legacy, decode only API that was
|
||||
supported, but deprecated, at the initial release of libvpx
|
||||
(v0.9.0). This is not expected to have any impact. If you are
|
||||
impacted, you can apply a reversion to commit 2bf8fb58 locally.
|
||||
Please update to the latest libvpx API if you are affected.
|
||||
|
||||
- Enhancements:
|
||||
Adds a motion compensated temporal denoiser to the encoder, which
|
||||
gives higher quality than the older spatial denoiser. (See above
|
||||
for notes on upgrading).
|
||||
|
||||
In addition, support for new compilers and platforms were added,
|
||||
including:
|
||||
improved support for XCode
|
||||
Android x86 NDK build
|
||||
OS/2 support
|
||||
SunCC support
|
||||
|
||||
Changing resolution with vpx_codec_enc_config_set() is now
|
||||
supported. Previously, reinitializing the codec was required to
|
||||
change the input resolution.
|
||||
|
||||
The vpxenc application has initial support for producing multiple
|
||||
encodes from the same input in one call. Resizing is not yet
|
||||
supported, but varying other codec parameters is. Use -- to
|
||||
delineate output streams. Options persist from one stream to the
|
||||
next.
|
||||
|
||||
Also, the vpxenc application will now use a keyframe interval of
|
||||
5 seconds by default. Use the --kf-max-dist option to override.
|
||||
|
||||
- Speed:
|
||||
Decoder performance improved 2.5% versus Duclair. Encoder speed is
|
||||
consistent with Duclair for most material. Two pass encoding of
|
||||
slideshow-like material will see significant improvements.
|
||||
|
||||
Large realtime encoding speed gains at a small quality expense are
|
||||
possible by configuring the on-the-fly bitpacking experiment with
|
||||
--enable-onthefly-bitpacking. Realtime encoder can be up to 13%
|
||||
faster (ARM) depending on the number of threads and bitrate
|
||||
settings. This technique sees constant gain over the 5-16 speed
|
||||
range. For VC style input the loss seen is up to 0.2dB. See commit
|
||||
52cf4dca for further details.
|
||||
|
||||
- Quality:
|
||||
On the whole, quality is consistent with the Duclair release. Some
|
||||
tweaks:
|
||||
|
||||
Reduced blockiness in easy sections by applying a penalty to
|
||||
intra modes.
|
||||
|
||||
Improved quality of static sections (like slideshows) with
|
||||
two pass encoding.
|
||||
|
||||
Improved keyframe sizing with multiple temporal layers
|
||||
|
||||
- Bug Fixes:
|
||||
Corrected alt-ref contribution to frame rate for visible updates
|
||||
to the alt-ref buffer. This affected applications making manual
|
||||
usage of the frame reference flags, or temporal layers.
|
||||
|
||||
Additional constraints were added to disable multi-frame quality
|
||||
enhancement (MFQE) in sections of the frame where there is motion.
|
||||
(#392)
|
||||
|
||||
Fixed corruption issues when vpx_codec_enc_config_set() was called
|
||||
with spatial resampling enabled.
|
||||
|
||||
Fixed a decoder error introduced in Duclair where the segmentation
|
||||
map was not being reinitialized on keyframes (#378)
|
||||
|
||||
|
||||
2012-01-27 v1.0.0 "Duclair"
|
||||
Our fourth named release, focused on performance and features related to
|
||||
real-time encoding. It also fixes a decoder crash bug introduced in
|
||||
|
12
README
12
README
@@ -1,5 +1,5 @@
|
||||
vpx Multi-Format Codec SDK
|
||||
README - 19 May 2010
|
||||
README - 21 June 2012
|
||||
|
||||
Welcome to the WebM VP8 Codec SDK!
|
||||
|
||||
@@ -15,11 +15,19 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
* Building the documentation requires PHP[3] and Doxygen[4]. If you do not
|
||||
have these packages, you must pass --disable-install-docs to the
|
||||
configure script.
|
||||
* Downloading the data for the unit tests requires curl[5] and sha1sum.
|
||||
sha1sum is provided via the GNU coreutils, installed by default on
|
||||
many *nix platforms, as well as MinGW and Cygwin. If coreutils is not
|
||||
available, a compatible version of sha1sum can be built from
|
||||
source[6]. These requirements are optional if not running the unit
|
||||
tests.
|
||||
|
||||
[1]: http://www.tortall.net/projects/yasm
|
||||
[2]: http://www.cygwin.com
|
||||
[3]: http://php.net
|
||||
[4]: http://www.doxygen.org
|
||||
[5]: http://curl.haxx.se
|
||||
[6]: http://www.microbrew.org/tools/md5sha1sum/
|
||||
|
||||
2. Out-of-tree builds
|
||||
Out of tree builds are a supported method of building the application. For
|
||||
@@ -94,5 +102,5 @@ COMPILING THE APPLICATIONS/LIBRARIES:
|
||||
|
||||
SUPPORT
|
||||
This library is an open source project supported by its community. Please
|
||||
please email webm-users@webmproject.org for help.
|
||||
please email webm-discuss@webmproject.org for help.
|
||||
|
||||
|
@@ -27,15 +27,22 @@
|
||||
# Android.mk file in the libvpx directory:
|
||||
# LOCAL_PATH := $(call my-dir)
|
||||
# include $(CLEAR_VARS)
|
||||
# include libvpx/build/make/Android.mk
|
||||
# include jni/libvpx/build/make/Android.mk
|
||||
#
|
||||
# There are currently two TARGET_ARCH_ABI targets for ARM.
|
||||
# armeabi and armeabi-v7a. armeabi-v7a is selected by creating an
|
||||
# Application.mk in the jni directory that contains:
|
||||
# APP_ABI := armeabi-v7a
|
||||
#
|
||||
# By default libvpx will detect at runtime the existance of NEON extension.
|
||||
# For this we import the 'cpufeatures' module from the NDK sources.
|
||||
# libvpx can also be configured without this runtime detection method.
|
||||
# Configuring with --disable-runtime-cpu-detect will assume presence of NEON.
|
||||
# Configuring with --disable-runtime-cpu-detect --disable-neon will remove any
|
||||
# NEON dependency.
|
||||
|
||||
# To change to building armeabi, run ./libvpx/configure again, but with
|
||||
# --target=arm5te-android-gcc and and modify the Application.mk file to
|
||||
# --target=arm5te-android-gcc and modify the Application.mk file to
|
||||
# set APP_ABI := armeabi
|
||||
#
|
||||
# Running ndk-build will build libvpx and include it in your project.
|
||||
@@ -99,7 +106,7 @@ $$(eval $$(call ev-build-file))
|
||||
|
||||
$(1) : $$(_OBJ) $(2)
|
||||
@mkdir -p $$(dir $$@)
|
||||
@grep -w EQU $$< | tr -d '\#' | $(CONFIG_DIR)/$(ASM_CONVERSION) > $$@
|
||||
@grep $(OFFSET_PATTERN) $$< | tr -d '\#' | $(CONFIG_DIR)/$(ASM_CONVERSION) > $$@
|
||||
endef
|
||||
|
||||
# Use ads2gas script to convert from RVCT format to GAS format. This passes
|
||||
@@ -118,6 +125,9 @@ $(ASM_CNV_PATH)/libvpx/%.asm.s: $(LIBVPX_PATH)/%.asm $(ASM_CNV_OFFSETS_DEPEND)
|
||||
@mkdir -p $(dir $@)
|
||||
@$(CONFIG_DIR)/$(ASM_CONVERSION) <$< > $@
|
||||
|
||||
# For building vpx_rtcd.h, which has a rule in libs.mk
|
||||
TGT_ISA:=$(word 1, $(subst -, ,$(TOOLCHAIN)))
|
||||
target := libs
|
||||
|
||||
LOCAL_SRC_FILES += vpx_config.c
|
||||
|
||||
@@ -163,7 +173,11 @@ LOCAL_MODULE := libvpx
|
||||
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := cpufeatures
|
||||
ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
|
||||
LOCAL_STATIC_LIBRARIES := cpufeatures
|
||||
endif
|
||||
|
||||
$(foreach file, $(LOCAL_SRC_FILES), $(LOCAL_PATH)/$(file)): vpx_rtcd.h
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@@ -171,6 +185,7 @@ clean:
|
||||
@$(RM) $(CODEC_SRCS_ASM_ADS2GAS) $(CODEC_SRCS_ASM_NEON_ADS2GAS)
|
||||
@$(RM) $(patsubst %.asm, %.*, $(ASM_CNV_OFFSETS_DEPEND))
|
||||
@$(RM) -r $(ASM_CNV_PATH)
|
||||
@$(RM) $(CLEAN-OBJS)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -190,4 +205,7 @@ ifeq ($(CONFIG_VP8_ENCODER), yes)
|
||||
$(LIBVPX_PATH)/vp8/encoder/asm_enc_offsets.c))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
|
||||
$(call import-module,cpufeatures)
|
||||
endif
|
||||
|
||||
|
@@ -21,6 +21,7 @@ all: .DEFAULT
|
||||
clean:: .DEFAULT
|
||||
install:: .DEFAULT
|
||||
test:: .DEFAULT
|
||||
testdata:: .DEFAULT
|
||||
|
||||
|
||||
# Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
|
||||
@@ -66,6 +67,7 @@ endif
|
||||
BUILD_ROOT?=.
|
||||
VPATH=$(SRC_PATH_BARE)
|
||||
CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
|
||||
CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
|
||||
ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/
|
||||
DIST_DIR?=dist
|
||||
HOSTCC?=gcc
|
||||
@@ -98,6 +100,8 @@ dist:
|
||||
install::
|
||||
.PHONY: test
|
||||
test::
|
||||
.PHONY: testdata
|
||||
testdata::
|
||||
|
||||
$(BUILD_PFX)%.c.d: %.c
|
||||
$(if $(quiet),@echo " [DEP] $@")
|
||||
@@ -111,11 +115,11 @@ $(BUILD_PFX)%.c.o: %.c
|
||||
$(BUILD_PFX)%.cc.d: %.cc
|
||||
$(if $(quiet),@echo " [DEP] $@")
|
||||
$(qexec)mkdir -p $(dir $@)
|
||||
$(qexec)g++ $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@
|
||||
$(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@
|
||||
|
||||
$(BUILD_PFX)%.cc.o: %.cc
|
||||
$(if $(quiet),@echo " [CXX] $@")
|
||||
$(qexec)g++ $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
$(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
$(BUILD_PFX)%.asm.d: %.asm
|
||||
$(if $(quiet),@echo " [DEP] $@")
|
||||
@@ -213,7 +217,7 @@ define linkerxx_template
|
||||
$(1): $(filter-out -%,$(2))
|
||||
$(1):
|
||||
$(if $(quiet),@echo " [LD] $$@")
|
||||
$(qexec)g++ $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
|
||||
$(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
|
||||
endef
|
||||
# make-3.80 has a bug with expanding large input strings to the eval function,
|
||||
# which was triggered in some cases by the following component of
|
||||
|
@@ -26,12 +26,22 @@ print "\t.equ DO1STROUNDING, 0\n";
|
||||
|
||||
while (<STDIN>)
|
||||
{
|
||||
undef $comment;
|
||||
undef $line;
|
||||
$comment_char = ";";
|
||||
$comment_sub = "@";
|
||||
|
||||
# Handle comments.
|
||||
if (/$comment_char/)
|
||||
{
|
||||
$comment = "";
|
||||
($line, $comment) = /(.*?)$comment_char(.*)/;
|
||||
$_ = $line;
|
||||
}
|
||||
|
||||
# Load and store alignment
|
||||
s/@/,:/g;
|
||||
|
||||
# Comment character
|
||||
s/;/@/g;
|
||||
|
||||
# Hexadecimal constants prefaced by 0x
|
||||
s/#&/#0x/g;
|
||||
|
||||
@@ -51,16 +61,27 @@ while (<STDIN>)
|
||||
s/:SHR:/ >> /g;
|
||||
|
||||
# Convert ELSE to .else
|
||||
s/ELSE/.else/g;
|
||||
s/\bELSE\b/.else/g;
|
||||
|
||||
# Convert ENDIF to .endif
|
||||
s/ENDIF/.endif/g;
|
||||
s/\bENDIF\b/.endif/g;
|
||||
|
||||
# Convert ELSEIF to .elseif
|
||||
s/ELSEIF/.elseif/g;
|
||||
s/\bELSEIF\b/.elseif/g;
|
||||
|
||||
# Convert LTORG to .ltorg
|
||||
s/LTORG/.ltorg/g;
|
||||
s/\bLTORG\b/.ltorg/g;
|
||||
|
||||
# Convert endfunc to nothing.
|
||||
s/\bendfunc\b//ig;
|
||||
|
||||
# Convert FUNCTION to nothing.
|
||||
s/\bFUNCTION\b//g;
|
||||
s/\bfunction\b//g;
|
||||
|
||||
s/\bENTRY\b//g;
|
||||
s/\bMSARMASM\b/0/g;
|
||||
s/^\s+end\s+$//g;
|
||||
|
||||
# Convert IF :DEF:to .if
|
||||
# gcc doesn't have the ability to do a conditional
|
||||
@@ -106,6 +127,7 @@ while (<STDIN>)
|
||||
if (s/RN\s+([Rr]\d+|lr)/.req $1/)
|
||||
{
|
||||
print;
|
||||
print "$comment_sub$comment\n" if defined $comment;
|
||||
next;
|
||||
}
|
||||
|
||||
@@ -114,6 +136,9 @@ while (<STDIN>)
|
||||
s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/;
|
||||
s/IMPORT\s+\|([\$\w]*)\|/.global $1/;
|
||||
|
||||
s/EXPORT\s+([\$\w]*)/.global $1/;
|
||||
s/export\s+([\$\w]*)/.global $1/;
|
||||
|
||||
# No vertical bars required; make additional symbol with prepended
|
||||
# underscore
|
||||
s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
|
||||
@@ -124,11 +149,19 @@ while (<STDIN>)
|
||||
s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
|
||||
|
||||
# ALIGN directive
|
||||
s/ALIGN/.balign/g;
|
||||
s/\bALIGN\b/.balign/g;
|
||||
|
||||
# ARM code
|
||||
s/\sARM/.arm/g;
|
||||
|
||||
# push/pop
|
||||
s/(push\s+)(r\d+)/stmdb sp\!, \{$2\}/g;
|
||||
s/(pop\s+)(r\d+)/ldmia sp\!, \{$2\}/g;
|
||||
|
||||
# NEON code
|
||||
s/(vld1.\d+\s+)(q\d+)/$1\{$2\}/g;
|
||||
s/(vtbl.\d+\s+[^,]+),([^,]+)/$1,\{$2\}/g;
|
||||
|
||||
# eabi_attributes numerical equivalents can be found in the
|
||||
# "ARM IHI 0045C" document.
|
||||
|
||||
@@ -157,10 +190,10 @@ while (<STDIN>)
|
||||
}
|
||||
|
||||
# EQU directive
|
||||
s/(.*)EQU(.*)/.equ $1, $2/;
|
||||
s/(\S+\s+)EQU(\s+\S+)/.equ $1, $2/;
|
||||
|
||||
# Begin macro definition
|
||||
if (/MACRO/) {
|
||||
if (/\bMACRO\b/) {
|
||||
$_ = <STDIN>;
|
||||
s/^/.macro/;
|
||||
s/\$//g; # remove formal param reference
|
||||
@@ -169,9 +202,10 @@ while (<STDIN>)
|
||||
|
||||
# For macros, use \ to reference formal params
|
||||
s/\$/\\/g; # End macro definition
|
||||
s/MEND/.endm/; # No need to tell it where to stop assembling
|
||||
s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
|
||||
next if /^\s*END\s*$/;
|
||||
print;
|
||||
print "$comment_sub$comment\n" if defined $comment;
|
||||
}
|
||||
|
||||
# Mark that this object doesn't need an executable stack.
|
||||
|
@@ -166,6 +166,17 @@ is_in(){
|
||||
|
||||
add_cflags() {
|
||||
CFLAGS="${CFLAGS} $@"
|
||||
CXXFLAGS="${CXXFLAGS} $@"
|
||||
}
|
||||
|
||||
|
||||
add_cflags_only() {
|
||||
CFLAGS="${CFLAGS} $@"
|
||||
}
|
||||
|
||||
|
||||
add_cxxflags_only() {
|
||||
CXXFLAGS="${CXXFLAGS} $@"
|
||||
}
|
||||
|
||||
|
||||
@@ -277,6 +288,13 @@ check_cc() {
|
||||
check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}
|
||||
}
|
||||
|
||||
check_cxx() {
|
||||
log check_cxx "$@"
|
||||
cat >${TMP_C}
|
||||
log_file ${TMP_C}
|
||||
check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}
|
||||
}
|
||||
|
||||
check_cpp() {
|
||||
log check_cpp "$@"
|
||||
cat > ${TMP_C}
|
||||
@@ -310,8 +328,25 @@ int x;
|
||||
EOF
|
||||
}
|
||||
|
||||
check_cxxflags() {
|
||||
log check_cxxflags "$@"
|
||||
|
||||
# Catch CFLAGS that trigger CXX warnings
|
||||
case "$CXX" in
|
||||
*g++*) check_cxx -Werror "$@" <<EOF
|
||||
int x;
|
||||
EOF
|
||||
;;
|
||||
*) check_cxx "$@" <<EOF
|
||||
int x;
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_add_cflags() {
|
||||
check_cflags "$@" && add_cflags "$@"
|
||||
check_cxxflags "$@" && add_cxxflags_only "$@"
|
||||
check_cflags "$@" && add_cflags_only "$@"
|
||||
}
|
||||
|
||||
check_add_asflags() {
|
||||
@@ -367,7 +402,9 @@ true
|
||||
|
||||
write_common_target_config_mk() {
|
||||
local CC=${CC}
|
||||
local CXX=${CXX}
|
||||
enabled ccache && CC="ccache ${CC}"
|
||||
enabled ccache && CXX="ccache ${CXX}"
|
||||
print_webm_license $1 "##" ""
|
||||
|
||||
cat >> $1 << EOF
|
||||
@@ -379,6 +416,7 @@ TOOLCHAIN=${toolchain}
|
||||
ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl}
|
||||
|
||||
CC=${CC}
|
||||
CXX=${CXX}
|
||||
AR=${AR}
|
||||
LD=${LD}
|
||||
AS=${AS}
|
||||
@@ -386,11 +424,14 @@ STRIP=${STRIP}
|
||||
NM=${NM}
|
||||
|
||||
CFLAGS = ${CFLAGS}
|
||||
CXXFLAGS = ${CXXFLAGS}
|
||||
ARFLAGS = -rus\$(if \$(quiet),c,v)
|
||||
LDFLAGS = ${LDFLAGS}
|
||||
ASFLAGS = ${ASFLAGS}
|
||||
extralibs = ${extralibs}
|
||||
AS_SFX = ${AS_SFX:-.asm}
|
||||
EXE_SFX = ${EXE_SFX}
|
||||
RTCD_OPTIONS = ${RTCD_OPTIONS}
|
||||
EOF
|
||||
|
||||
if enabled rvct; then cat >> $1 << EOF
|
||||
@@ -454,9 +495,25 @@ process_common_cmdline() {
|
||||
;;
|
||||
--enable-?*|--disable-?*)
|
||||
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
|
||||
echo "${CMDLINE_SELECT} ${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null || die_unknown $opt
|
||||
if echo "${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null; then
|
||||
[ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}${opt} "
|
||||
elif [ $action = "disable" ] && ! disabled $option ; then
|
||||
echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null ||
|
||||
die_unknown $opt
|
||||
elif [ $action = "enable" ] && ! enabled $option ; then
|
||||
echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null ||
|
||||
die_unknown $opt
|
||||
fi
|
||||
$action $option
|
||||
;;
|
||||
--require-?*)
|
||||
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
|
||||
if echo "${ARCH_EXT_LIST}" none | grep "^ *$option\$" >/dev/null; then
|
||||
RTCD_OPTIONS="${RTCD_OPTIONS}${opt} "
|
||||
else
|
||||
die_unknown $opt
|
||||
fi
|
||||
;;
|
||||
--force-enable-?*|--force-disable-?*)
|
||||
eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'`
|
||||
$action $option
|
||||
@@ -520,20 +577,31 @@ post_process_cmdline() {
|
||||
|
||||
setup_gnu_toolchain() {
|
||||
CC=${CC:-${CROSS}gcc}
|
||||
CXX=${CXX:-${CROSS}g++}
|
||||
AR=${AR:-${CROSS}ar}
|
||||
LD=${LD:-${CROSS}${link_with_cc:-ld}}
|
||||
AS=${AS:-${CROSS}as}
|
||||
STRIP=${STRIP:-${CROSS}strip}
|
||||
NM=${NM:-${CROSS}nm}
|
||||
AS_SFX=.s
|
||||
EXE_SFX=
|
||||
}
|
||||
|
||||
process_common_toolchain() {
|
||||
if [ -z "$toolchain" ]; then
|
||||
gcctarget="$(gcc -dumpmachine 2> /dev/null)"
|
||||
gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}"
|
||||
|
||||
# detect tgt_isa
|
||||
case "$gcctarget" in
|
||||
armv6*)
|
||||
tgt_isa=armv6
|
||||
;;
|
||||
armv7*)
|
||||
tgt_isa=armv7
|
||||
;;
|
||||
armv5te*)
|
||||
tgt_isa=armv5te
|
||||
;;
|
||||
*x86_64*|*amd64*)
|
||||
tgt_isa=x86_64
|
||||
;;
|
||||
@@ -569,6 +637,10 @@ process_common_toolchain() {
|
||||
tgt_isa=x86_64
|
||||
tgt_os=darwin11
|
||||
;;
|
||||
*darwin12*)
|
||||
tgt_isa=x86_64
|
||||
tgt_os=darwin12
|
||||
;;
|
||||
*mingw32*|*cygwin*)
|
||||
[ -z "$tgt_isa" ] && tgt_isa=x86
|
||||
tgt_os=win32
|
||||
@@ -579,6 +651,9 @@ process_common_toolchain() {
|
||||
*solaris2.10)
|
||||
tgt_os=solaris
|
||||
;;
|
||||
*os2*)
|
||||
tgt_os=os2
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then
|
||||
@@ -616,44 +691,51 @@ process_common_toolchain() {
|
||||
|
||||
# Handle darwin variants. Newer SDKs allow targeting older
|
||||
# platforms, so find the newest SDK available.
|
||||
if [ -d "/Developer/SDKs/MacOSX10.4u.sdk" ]; then
|
||||
osx_sdk_dir="/Developer/SDKs/MacOSX10.4u.sdk"
|
||||
fi
|
||||
if [ -d "/Developer/SDKs/MacOSX10.5.sdk" ]; then
|
||||
osx_sdk_dir="/Developer/SDKs/MacOSX10.5.sdk"
|
||||
fi
|
||||
if [ -d "/Developer/SDKs/MacOSX10.6.sdk" ]; then
|
||||
osx_sdk_dir="/Developer/SDKs/MacOSX10.6.sdk"
|
||||
fi
|
||||
if [ -d "/Developer/SDKs/MacOSX10.7.sdk" ]; then
|
||||
osx_sdk_dir="/Developer/SDKs/MacOSX10.7.sdk"
|
||||
case ${toolchain} in
|
||||
*-darwin*)
|
||||
if [ -z "${DEVELOPER_DIR}" ]; then
|
||||
DEVELOPER_DIR=`xcode-select -print-path 2> /dev/null`
|
||||
[ $? -ne 0 ] && OSX_SKIP_DIR_CHECK=1
|
||||
fi
|
||||
if [ -z "${OSX_SKIP_DIR_CHECK}" ]; then
|
||||
OSX_SDK_ROOTS="${DEVELOPER_DIR}/SDKs"
|
||||
OSX_SDK_VERSIONS="MacOSX10.4u.sdk MacOSX10.5.sdk MacOSX10.6.sdk"
|
||||
OSX_SDK_VERSIONS="${OSX_SDK_VERSIONS} MacOSX10.7.sdk"
|
||||
for v in ${OSX_SDK_VERSIONS}; do
|
||||
if [ -d "${OSX_SDK_ROOTS}/${v}" ]; then
|
||||
osx_sdk_dir="${OSX_SDK_ROOTS}/${v}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -d "${osx_sdk_dir}" ]; then
|
||||
add_cflags "-isysroot ${osx_sdk_dir}"
|
||||
add_ldflags "-isysroot ${osx_sdk_dir}"
|
||||
fi
|
||||
|
||||
case ${toolchain} in
|
||||
*-darwin8-*)
|
||||
add_cflags "-isysroot ${osx_sdk_dir}"
|
||||
add_cflags "-mmacosx-version-min=10.4"
|
||||
add_ldflags "-isysroot ${osx_sdk_dir}"
|
||||
add_ldflags "-mmacosx-version-min=10.4"
|
||||
;;
|
||||
*-darwin9-*)
|
||||
add_cflags "-isysroot ${osx_sdk_dir}"
|
||||
add_cflags "-mmacosx-version-min=10.5"
|
||||
add_ldflags "-isysroot ${osx_sdk_dir}"
|
||||
add_ldflags "-mmacosx-version-min=10.5"
|
||||
;;
|
||||
*-darwin10-*)
|
||||
add_cflags "-isysroot ${osx_sdk_dir}"
|
||||
add_cflags "-mmacosx-version-min=10.6"
|
||||
add_ldflags "-isysroot ${osx_sdk_dir}"
|
||||
add_ldflags "-mmacosx-version-min=10.6"
|
||||
;;
|
||||
*-darwin11-*)
|
||||
add_cflags "-isysroot ${osx_sdk_dir}"
|
||||
add_cflags "-mmacosx-version-min=10.7"
|
||||
add_ldflags "-isysroot ${osx_sdk_dir}"
|
||||
add_ldflags "-mmacosx-version-min=10.7"
|
||||
;;
|
||||
*-darwin12-*)
|
||||
add_cflags "-mmacosx-version-min=10.8"
|
||||
add_ldflags "-mmacosx-version-min=10.8"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Handle Solaris variants. Solaris 10 needs -lposix4
|
||||
@@ -671,10 +753,23 @@ process_common_toolchain() {
|
||||
case ${toolchain} in
|
||||
arm*)
|
||||
# on arm, isa versions are supersets
|
||||
enabled armv7a && soft_enable armv7 ### DEBUG
|
||||
enabled armv7 && soft_enable armv6
|
||||
enabled armv7 || enabled armv6 && soft_enable armv5te
|
||||
enabled armv7 || enabled armv6 && soft_enable fast_unaligned
|
||||
case ${tgt_isa} in
|
||||
armv7)
|
||||
soft_enable neon
|
||||
soft_enable media
|
||||
soft_enable edsp
|
||||
soft_enable fast_unaligned
|
||||
;;
|
||||
armv6)
|
||||
soft_enable media
|
||||
soft_enable edsp
|
||||
soft_enable fast_unaligned
|
||||
;;
|
||||
armv5te)
|
||||
soft_enable edsp
|
||||
disable fast_unaligned
|
||||
;;
|
||||
esac
|
||||
|
||||
asm_conversion_cmd="cat"
|
||||
|
||||
@@ -687,14 +782,24 @@ process_common_toolchain() {
|
||||
arch_int=${arch_int%%te}
|
||||
check_add_asflags --defsym ARCHITECTURE=${arch_int}
|
||||
tune_cflags="-mtune="
|
||||
if enabled armv7
|
||||
then
|
||||
check_add_cflags -march=armv7-a -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-ftree-vectorize
|
||||
check_add_asflags -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-march=armv7-a
|
||||
if [ ${tgt_isa} == "armv7" ]; then
|
||||
check_add_cflags -march=armv7-a -mfloat-abi=softfp
|
||||
check_add_asflags -march=armv7-a -mfloat-abi=softfp
|
||||
|
||||
if enabled neon
|
||||
then
|
||||
check_add_cflags -mfpu=neon #-ftree-vectorize
|
||||
check_add_asflags -mfpu=neon
|
||||
fi
|
||||
|
||||
if [ -z "${tune_cpu}" ]; then
|
||||
tune_cpu=cortex-a8
|
||||
fi
|
||||
else
|
||||
check_add_cflags -march=${tgt_isa}
|
||||
check_add_asflags -march=${tgt_isa}
|
||||
fi
|
||||
|
||||
enabled debug && add_asflags -g
|
||||
asm_conversion_cmd="${source_path}/build/make/ads2gas.pl"
|
||||
;;
|
||||
@@ -708,10 +813,14 @@ process_common_toolchain() {
|
||||
tune_cflags="--cpu="
|
||||
tune_asflags="--cpu="
|
||||
if [ -z "${tune_cpu}" ]; then
|
||||
if enabled armv7
|
||||
then
|
||||
check_add_cflags --cpu=Cortex-A8 --fpu=softvfp+vfpv3
|
||||
check_add_asflags --cpu=Cortex-A8 --fpu=softvfp+vfpv3
|
||||
if [ ${tgt_isa} == "armv7" ]; then
|
||||
if enabled neon
|
||||
then
|
||||
check_add_cflags --fpu=softvfp+vfpv3
|
||||
check_add_asflags --fpu=softvfp+vfpv3
|
||||
fi
|
||||
check_add_cflags --cpu=Cortex-A8
|
||||
check_add_asflags --cpu=Cortex-A8
|
||||
else
|
||||
check_add_cflags --cpu=${tgt_isa##armv}
|
||||
check_add_asflags --cpu=${tgt_isa##armv}
|
||||
@@ -739,6 +848,7 @@ process_common_toolchain() {
|
||||
-name "arm-linux-androideabi-gcc*" -print -quit`
|
||||
TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi-
|
||||
CC=${TOOLCHAIN_PATH}gcc
|
||||
CXX=${TOOLCHAIN_PATH}g++
|
||||
AR=${TOOLCHAIN_PATH}ar
|
||||
LD=${TOOLCHAIN_PATH}gcc
|
||||
AS=${TOOLCHAIN_PATH}as
|
||||
@@ -757,21 +867,29 @@ process_common_toolchain() {
|
||||
add_cflags "--sysroot=${alt_libc}"
|
||||
add_ldflags "--sysroot=${alt_libc}"
|
||||
|
||||
# linker flag that routes around a CPU bug in some
|
||||
# Cortex-A8 implementations (NDK Dev Guide)
|
||||
add_ldflags "-Wl,--fix-cortex-a8"
|
||||
|
||||
enable pic
|
||||
soft_enable realtime_only
|
||||
if enabled armv7
|
||||
then
|
||||
enable runtime_cpu_detect
|
||||
if [ ${tgt_isa} == "armv7" ]; then
|
||||
soft_enable runtime_cpu_detect
|
||||
fi
|
||||
if enabled runtime_cpu_detect; then
|
||||
add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
|
||||
fi
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
if [ -z "${sdk_path}" ]; then
|
||||
SDK_PATH=/Developer/Platforms/iPhoneOS.platform/Developer
|
||||
SDK_PATH=`xcode-select -print-path 2> /dev/null`
|
||||
SDK_PATH=${SDK_PATH}/Platforms/iPhoneOS.platform/Developer
|
||||
else
|
||||
SDK_PATH=${sdk_path}
|
||||
fi
|
||||
TOOLCHAIN_PATH=${SDK_PATH}/usr/bin
|
||||
CXX=${TOOLCHAIN_PATH}/g++
|
||||
CC=${TOOLCHAIN_PATH}/gcc
|
||||
AR=${TOOLCHAIN_PATH}/ar
|
||||
LD=${TOOLCHAIN_PATH}/arm-apple-darwin10-llvm-gcc-4.2
|
||||
@@ -789,7 +907,7 @@ process_common_toolchain() {
|
||||
add_ldflags -arch_only ${tgt_isa}
|
||||
|
||||
if [ -z "${alt_libc}" ]; then
|
||||
alt_libc=${SDK_PATH}/SDKs/iPhoneOS5.0.sdk
|
||||
alt_libc=${SDK_PATH}/SDKs/iPhoneOS5.1.sdk
|
||||
fi
|
||||
|
||||
add_cflags "-isysroot ${alt_libc}"
|
||||
@@ -835,13 +953,16 @@ process_common_toolchain() {
|
||||
esac
|
||||
;;
|
||||
mips*)
|
||||
CROSS=${CROSS:-mipsel-linux-uclibc-}
|
||||
link_with_cc=gcc
|
||||
setup_gnu_toolchain
|
||||
tune_cflags="-mtune="
|
||||
if enabled dspr2; then
|
||||
check_add_cflags -mips32r2 -mdspr2
|
||||
disable fast_unaligned
|
||||
fi
|
||||
check_add_cflags -march=${tgt_isa}
|
||||
check_add_asflags -march=${tgt_isa}
|
||||
check_add_asflags -KPIC
|
||||
check_add_asflags -march=${tgt_isa}
|
||||
check_add_asflags -KPIC
|
||||
;;
|
||||
ppc*)
|
||||
enable ppc
|
||||
@@ -869,6 +990,11 @@ process_common_toolchain() {
|
||||
x86*)
|
||||
bits=32
|
||||
enabled x86_64 && bits=64
|
||||
check_cpp <<EOF && bits=x32
|
||||
#ifndef __ILP32__
|
||||
#error "not x32"
|
||||
#endif
|
||||
EOF
|
||||
soft_enable runtime_cpu_detect
|
||||
soft_enable mmx
|
||||
soft_enable sse
|
||||
@@ -883,9 +1009,13 @@ process_common_toolchain() {
|
||||
;;
|
||||
solaris*)
|
||||
CC=${CC:-${CROSS}gcc}
|
||||
CXX=${CXX:-${CROSS}g++}
|
||||
LD=${LD:-${CROSS}gcc}
|
||||
CROSS=${CROSS:-g}
|
||||
;;
|
||||
os2)
|
||||
AS=${AS:-nasm}
|
||||
;;
|
||||
esac
|
||||
|
||||
AS="${alt_as:-${AS:-auto}}"
|
||||
@@ -907,16 +1037,22 @@ process_common_toolchain() {
|
||||
tune_cflags="-march="
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
;;
|
||||
gcc*)
|
||||
add_cflags -m${bits}
|
||||
add_cflags -m${bits}
|
||||
add_ldflags -m${bits}
|
||||
link_with_cc=gcc
|
||||
tune_cflags="-march="
|
||||
setup_gnu_toolchain
|
||||
#for 32 bit x86 builds, -O3 did not turn on this flag
|
||||
enabled optimizations && check_add_cflags -fomit-frame-pointer
|
||||
;;
|
||||
;;
|
||||
vs*)
|
||||
# When building with Microsoft Visual Studio the assembler is
|
||||
# invoked directly. Checking at configure time is unnecessary.
|
||||
# Skip the check by setting AS arbitrarily
|
||||
AS=msvs
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${AS}" in
|
||||
@@ -925,7 +1061,7 @@ process_common_toolchain() {
|
||||
which yasm >/dev/null 2>&1 && AS=yasm
|
||||
[ "${AS}" = auto -o -z "${AS}" ] \
|
||||
&& die "Neither yasm nor nasm have been found"
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
log_echo " using $AS"
|
||||
[ "${AS##*/}" = nasm ] && add_asflags -Ox
|
||||
@@ -956,6 +1092,11 @@ process_common_toolchain() {
|
||||
# enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic
|
||||
enabled icc && ! enabled pic && add_cflags -fno-pic
|
||||
;;
|
||||
os2)
|
||||
add_asflags -f aout
|
||||
enabled debug && add_asflags -g
|
||||
EXE_SFX=.exe
|
||||
;;
|
||||
*) log "Warning: Unknown os $tgt_os while setting up $AS flags"
|
||||
;;
|
||||
esac
|
||||
@@ -1002,7 +1143,7 @@ process_common_toolchain() {
|
||||
|
||||
# Work around longjmp interception on glibc >= 2.11, to improve binary
|
||||
# compatibility. See http://code.google.com/p/webm/issues/detail?id=166
|
||||
enabled linux && check_add_cflags -D_FORTIFY_SOURCE=0
|
||||
enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
|
||||
|
||||
# Check for strip utility variant
|
||||
${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable gnu_strip
|
||||
@@ -1017,12 +1158,24 @@ EOF
|
||||
# Almost every platform uses pthreads.
|
||||
if enabled multithread; then
|
||||
case ${toolchain} in
|
||||
*-win*);;
|
||||
*-win*-vs*);;
|
||||
*-android-gcc);;
|
||||
*) check_header pthread.h && add_extralibs -lpthread
|
||||
esac
|
||||
fi
|
||||
|
||||
# only for MIPS platforms
|
||||
case ${toolchain} in
|
||||
mips*)
|
||||
if enabled dspr2; then
|
||||
if enabled big_endian; then
|
||||
echo "dspr2 optimizations are available only for little endian platforms"
|
||||
disable dspr2
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# for sysconf(3) and friends.
|
||||
check_header unistd.h
|
||||
|
||||
|
@@ -42,7 +42,7 @@ done
|
||||
|
||||
[ -n "$srcfile" ] || show_help
|
||||
sfx=${sfx:-asm}
|
||||
includes=$(egrep -i "include +\"?+[a-z0-9_/]+\.${sfx}" $srcfile |
|
||||
includes=$(LC_ALL=C egrep -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
|
||||
perl -p -e "s;.*?([a-z0-9_/]+.${sfx}).*;\1;")
|
||||
#" restore editor state
|
||||
for inc in ${includes}; do
|
||||
|
@@ -680,7 +680,7 @@ int parse_coff(uint8_t *buf, size_t sz)
|
||||
uint32_t symoffset;
|
||||
|
||||
char **sectionlist; //this array holds all section names in their correct order.
|
||||
//it is used to check if the symbol is in .bss or .data section.
|
||||
//it is used to check if the symbol is in .bss or .rdata section.
|
||||
|
||||
nsections = get_le16(buf + 2);
|
||||
symtab_ptr = get_le32(buf + 8);
|
||||
@@ -725,15 +725,15 @@ int parse_coff(uint8_t *buf, size_t sz)
|
||||
}
|
||||
strcpy(sectionlist[i], sectionname);
|
||||
|
||||
if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20);
|
||||
if (!strcmp(sectionname, ".rdata")) sectionrawdata_ptr = get_le32(ptr + 20);
|
||||
|
||||
ptr += 40;
|
||||
}
|
||||
|
||||
//log_msg("COFF: Symbol table at offset %u\n", symtab_ptr);
|
||||
//log_msg("COFF: raw data pointer ofset for section .data is %u\n", sectionrawdata_ptr);
|
||||
//log_msg("COFF: raw data pointer ofset for section .rdata is %u\n", sectionrawdata_ptr);
|
||||
|
||||
/* The compiler puts the data with non-zero offset in .data section, but puts the data with
|
||||
/* The compiler puts the data with non-zero offset in .rdata section, but puts the data with
|
||||
zero offset in .bss section. So, if the data in in .bss section, set offset=0.
|
||||
Note from Wiki: In an object module compiled from C, the bss section contains
|
||||
the local variables (but not functions) that were declared with the static keyword,
|
||||
|
356
build/make/rtcd.sh
Executable file
356
build/make/rtcd.sh
Executable file
@@ -0,0 +1,356 @@
|
||||
#!/bin/sh
|
||||
self=$0
|
||||
|
||||
usage() {
|
||||
cat <<EOF >&2
|
||||
Usage: $self [options] FILE
|
||||
|
||||
Reads the Run Time CPU Detections definitions from FILE and generates a
|
||||
C header file on stdout.
|
||||
|
||||
Options:
|
||||
--arch=ARCH Architecture to generate defs for (required)
|
||||
--disable-EXT Disable support for EXT extensions
|
||||
--require-EXT Require support for EXT extensions
|
||||
--sym=SYMBOL Unique symbol to use for RTCD initialization function
|
||||
--config=FILE File with CONFIG_FOO=yes lines to parse
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
die() {
|
||||
echo "$@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
die_argument_required() {
|
||||
die "Option $opt requires argument"
|
||||
}
|
||||
|
||||
for opt; do
|
||||
optval="${opt#*=}"
|
||||
case "$opt" in
|
||||
--arch) die_argument_required;;
|
||||
--arch=*) arch=${optval};;
|
||||
--disable-*) eval "disable_${opt#--disable-}=true";;
|
||||
--require-*) REQUIRES="${REQUIRES}${opt#--require-} ";;
|
||||
--sym) die_argument_required;;
|
||||
--sym=*) symbol=${optval};;
|
||||
--config=*) config_file=${optval};;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-*)
|
||||
die "Unrecognized option: ${opt%%=*}"
|
||||
;;
|
||||
*)
|
||||
defs_file="$defs_file $opt"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
for f in $defs_file; do [ -f "$f" ] || usage; done
|
||||
[ -n "$arch" ] || usage
|
||||
|
||||
# Import the configuration
|
||||
[ -f "$config_file" ] && eval $(grep CONFIG_ "$config_file")
|
||||
|
||||
#
|
||||
# Routines for the RTCD DSL to call
|
||||
#
|
||||
prototype() {
|
||||
local rtyp
|
||||
case "$1" in
|
||||
unsigned) rtyp="$1 "; shift;;
|
||||
esac
|
||||
rtyp="${rtyp}$1"
|
||||
local fn="$2"
|
||||
local args="$3"
|
||||
|
||||
eval "${2}_rtyp='$rtyp'"
|
||||
eval "${2}_args='$3'"
|
||||
ALL_FUNCS="$ALL_FUNCS $fn"
|
||||
specialize $fn c
|
||||
}
|
||||
|
||||
specialize() {
|
||||
local fn="$1"
|
||||
shift
|
||||
for opt in "$@"; do
|
||||
eval "${fn}_${opt}=${fn}_${opt}"
|
||||
done
|
||||
}
|
||||
|
||||
require() {
|
||||
for fn in $ALL_FUNCS; do
|
||||
for opt in "$@"; do
|
||||
local ofn=$(eval "echo \$${fn}_${opt}")
|
||||
[ -z "$ofn" ] && continue
|
||||
|
||||
# if we already have a default, then we can disable it, as we know
|
||||
# we can do better.
|
||||
local best=$(eval "echo \$${fn}_default")
|
||||
local best_ofn=$(eval "echo \$${best}")
|
||||
[ -n "$best" ] && [ "$best_ofn" != "$ofn" ] && eval "${best}_link=false"
|
||||
eval "${fn}_default=${fn}_${opt}"
|
||||
eval "${fn}_${opt}_link=true"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
forward_decls() {
|
||||
ALL_FORWARD_DECLS="$ALL_FORWARD_DECLS $1"
|
||||
}
|
||||
|
||||
#
|
||||
# Include the user's directives
|
||||
#
|
||||
for f in $defs_file; do
|
||||
. $f
|
||||
done
|
||||
|
||||
#
|
||||
# Process the directives according to the command line
|
||||
#
|
||||
process_forward_decls() {
|
||||
for fn in $ALL_FORWARD_DECLS; do
|
||||
eval $fn
|
||||
done
|
||||
}
|
||||
|
||||
determine_indirection() {
|
||||
[ "$CONFIG_RUNTIME_CPU_DETECT" = "yes" ] || require $ALL_ARCHS
|
||||
for fn in $ALL_FUNCS; do
|
||||
local n=""
|
||||
local rtyp="$(eval "echo \$${fn}_rtyp")"
|
||||
local args="$(eval "echo \"\$${fn}_args\"")"
|
||||
local dfn="$(eval "echo \$${fn}_default")"
|
||||
dfn=$(eval "echo \$${dfn}")
|
||||
for opt in "$@"; do
|
||||
local ofn=$(eval "echo \$${fn}_${opt}")
|
||||
[ -z "$ofn" ] && continue
|
||||
local link=$(eval "echo \$${fn}_${opt}_link")
|
||||
[ "$link" = "false" ] && continue
|
||||
n="${n}x"
|
||||
done
|
||||
if [ "$n" = "x" ]; then
|
||||
eval "${fn}_indirect=false"
|
||||
else
|
||||
eval "${fn}_indirect=true"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
declare_function_pointers() {
|
||||
for fn in $ALL_FUNCS; do
|
||||
local rtyp="$(eval "echo \$${fn}_rtyp")"
|
||||
local args="$(eval "echo \"\$${fn}_args\"")"
|
||||
local dfn="$(eval "echo \$${fn}_default")"
|
||||
dfn=$(eval "echo \$${dfn}")
|
||||
for opt in "$@"; do
|
||||
local ofn=$(eval "echo \$${fn}_${opt}")
|
||||
[ -z "$ofn" ] && continue
|
||||
echo "$rtyp ${ofn}($args);"
|
||||
done
|
||||
if [ "$(eval "echo \$${fn}_indirect")" = "false" ]; then
|
||||
echo "#define ${fn} ${dfn}"
|
||||
else
|
||||
echo "RTCD_EXTERN $rtyp (*${fn})($args);"
|
||||
fi
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
set_function_pointers() {
|
||||
for fn in $ALL_FUNCS; do
|
||||
local n=""
|
||||
local rtyp="$(eval "echo \$${fn}_rtyp")"
|
||||
local args="$(eval "echo \"\$${fn}_args\"")"
|
||||
local dfn="$(eval "echo \$${fn}_default")"
|
||||
dfn=$(eval "echo \$${dfn}")
|
||||
if $(eval "echo \$${fn}_indirect"); then
|
||||
echo " $fn = $dfn;"
|
||||
for opt in "$@"; do
|
||||
local ofn=$(eval "echo \$${fn}_${opt}")
|
||||
[ -z "$ofn" ] && continue
|
||||
[ "$ofn" = "$dfn" ] && continue;
|
||||
local link=$(eval "echo \$${fn}_${opt}_link")
|
||||
[ "$link" = "false" ] && continue
|
||||
local cond="$(eval "echo \$have_${opt}")"
|
||||
echo " if (${cond}) $fn = $ofn;"
|
||||
done
|
||||
fi
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
filter() {
|
||||
local filtered
|
||||
for opt in "$@"; do
|
||||
[ -z $(eval "echo \$disable_${opt}") ] && filtered="$filtered $opt"
|
||||
done
|
||||
echo $filtered
|
||||
}
|
||||
|
||||
#
|
||||
# Helper functions for generating the arch specific RTCD files
|
||||
#
|
||||
common_top() {
|
||||
local outfile_basename=$(basename ${symbol:-rtcd.h})
|
||||
local include_guard=$(echo $outfile_basename | tr '[a-z]' '[A-Z]' | tr -c '[A-Z]' _)
|
||||
cat <<EOF
|
||||
#ifndef ${include_guard}
|
||||
#define ${include_guard}
|
||||
|
||||
#ifdef RTCD_C
|
||||
#define RTCD_EXTERN
|
||||
#else
|
||||
#define RTCD_EXTERN extern
|
||||
#endif
|
||||
|
||||
$(process_forward_decls)
|
||||
|
||||
$(declare_function_pointers c $ALL_ARCHS)
|
||||
|
||||
void ${symbol:-rtcd}(void);
|
||||
EOF
|
||||
}
|
||||
|
||||
common_bottom() {
|
||||
cat <<EOF
|
||||
#endif
|
||||
EOF
|
||||
}
|
||||
|
||||
x86() {
|
||||
determine_indirection c $ALL_ARCHS
|
||||
|
||||
# Assign the helper variable for each enabled extension
|
||||
for opt in $ALL_ARCHS; do
|
||||
local uc=$(echo $opt | tr '[a-z]' '[A-Z]')
|
||||
eval "have_${opt}=\"flags & HAS_${uc}\""
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
$(common_top)
|
||||
|
||||
#ifdef RTCD_C
|
||||
#include "vpx_ports/x86.h"
|
||||
static void setup_rtcd_internal(void)
|
||||
{
|
||||
int flags = x86_simd_caps();
|
||||
|
||||
(void)flags;
|
||||
|
||||
$(set_function_pointers c $ALL_ARCHS)
|
||||
}
|
||||
#endif
|
||||
$(common_bottom)
|
||||
EOF
|
||||
}
|
||||
|
||||
arm() {
|
||||
determine_indirection c $ALL_ARCHS
|
||||
|
||||
# Assign the helper variable for each enabled extension
|
||||
for opt in $ALL_ARCHS; do
|
||||
local uc=$(echo $opt | tr '[a-z]' '[A-Z]')
|
||||
eval "have_${opt}=\"flags & HAS_${uc}\""
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
$(common_top)
|
||||
#include "vpx_config.h"
|
||||
|
||||
#ifdef RTCD_C
|
||||
#include "vpx_ports/arm.h"
|
||||
static void setup_rtcd_internal(void)
|
||||
{
|
||||
int flags = arm_cpu_caps();
|
||||
|
||||
(void)flags;
|
||||
|
||||
$(set_function_pointers c $ALL_ARCHS)
|
||||
}
|
||||
#endif
|
||||
$(common_bottom)
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
mips() {
|
||||
determine_indirection c $ALL_ARCHS
|
||||
cat <<EOF
|
||||
$(common_top)
|
||||
#include "vpx_config.h"
|
||||
|
||||
#ifdef RTCD_C
|
||||
static void setup_rtcd_internal(void)
|
||||
{
|
||||
$(set_function_pointers c $ALL_ARCHS)
|
||||
#if HAVE_DSPR2
|
||||
void dsputil_static_init();
|
||||
dsputil_static_init();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
$(common_bottom)
|
||||
EOF
|
||||
}
|
||||
|
||||
unoptimized() {
|
||||
determine_indirection c
|
||||
cat <<EOF
|
||||
$(common_top)
|
||||
#include "vpx_config.h"
|
||||
|
||||
#ifdef RTCD_C
|
||||
static void setup_rtcd_internal(void)
|
||||
{
|
||||
$(set_function_pointers c)
|
||||
}
|
||||
#endif
|
||||
$(common_bottom)
|
||||
EOF
|
||||
|
||||
}
|
||||
#
|
||||
# Main Driver
|
||||
#
|
||||
require c
|
||||
case $arch in
|
||||
x86)
|
||||
ALL_ARCHS=$(filter mmx sse sse2 sse3 ssse3 sse4_1)
|
||||
x86
|
||||
;;
|
||||
x86_64)
|
||||
ALL_ARCHS=$(filter mmx sse sse2 sse3 ssse3 sse4_1)
|
||||
REQUIRES=${REQUIRES:-mmx sse sse2}
|
||||
require $(filter $REQUIRES)
|
||||
x86
|
||||
;;
|
||||
mips32)
|
||||
ALL_ARCHS=$(filter mips32)
|
||||
dspr2=$([ -f "$config_file" ] && eval echo $(grep HAVE_DSPR2 "$config_file"))
|
||||
HAVE_DSPR2="${dspr2#*=}"
|
||||
if [ "$HAVE_DSPR2" = "yes" ]; then
|
||||
ALL_ARCHS=$(filter mips32 dspr2)
|
||||
fi
|
||||
mips
|
||||
;;
|
||||
armv5te)
|
||||
ALL_ARCHS=$(filter edsp)
|
||||
arm
|
||||
;;
|
||||
armv6)
|
||||
ALL_ARCHS=$(filter edsp media)
|
||||
arm
|
||||
;;
|
||||
armv7)
|
||||
ALL_ARCHS=$(filter edsp media neon)
|
||||
arm
|
||||
;;
|
||||
*)
|
||||
unoptimized
|
||||
;;
|
||||
esac
|
79
configure
vendored
79
configure
vendored
@@ -20,9 +20,10 @@ show_help(){
|
||||
show_help_pre
|
||||
cat << EOF
|
||||
Advanced options:
|
||||
${toggle_libs} don't build libraries
|
||||
${toggle_examples} don't build examples
|
||||
${toggle_unit_tests} build unit tests
|
||||
${toggle_libs} libraries
|
||||
${toggle_examples} examples
|
||||
${toggle_docs} documentation
|
||||
${toggle_unit_tests} unit tests
|
||||
--libc=PATH path to alternate libc
|
||||
--as={yasm|nasm|auto} use specified assembler [auto, yasm preferred]
|
||||
--sdk-path=PATH path to root of sdk (iOS, android builds only)
|
||||
@@ -39,6 +40,7 @@ Advanced options:
|
||||
${toggle_multithread} multithreaded encoding and decoding
|
||||
${toggle_spatial_resampling} spatial sampling (scaling) support
|
||||
${toggle_realtime_only} enable this option while building for real-time encoding
|
||||
${toggle_onthefly_bitpacking} enable on-the-fly bitpacking in real-time encoding
|
||||
${toggle_error_concealment} enable this option to get a decoder which is able to conceal losses
|
||||
${toggle_runtime_cpu_detect} runtime cpu detection
|
||||
${toggle_shared} shared library support
|
||||
@@ -46,6 +48,7 @@ Advanced options:
|
||||
${toggle_small} favor smaller size over speed
|
||||
${toggle_postproc_visualizer} macro block / block level visualizers
|
||||
${toggle_multi_res_encoding} enable multiple-resolution encoding
|
||||
${toggle_temporal_denoising} enable temporal denoising and disable the spatial denoiser
|
||||
|
||||
Codecs:
|
||||
Codecs can be selectively enabled or disabled individually, or by family:
|
||||
@@ -107,8 +110,11 @@ all_platforms="${all_platforms} x86-darwin8-icc"
|
||||
all_platforms="${all_platforms} x86-darwin9-gcc"
|
||||
all_platforms="${all_platforms} x86-darwin9-icc"
|
||||
all_platforms="${all_platforms} x86-darwin10-gcc"
|
||||
all_platforms="${all_platforms} x86-darwin11-gcc"
|
||||
all_platforms="${all_platforms} x86-darwin12-gcc"
|
||||
all_platforms="${all_platforms} x86-linux-gcc"
|
||||
all_platforms="${all_platforms} x86-linux-icc"
|
||||
all_platforms="${all_platforms} x86-os2-gcc"
|
||||
all_platforms="${all_platforms} x86-solaris-gcc"
|
||||
all_platforms="${all_platforms} x86-win32-gcc"
|
||||
all_platforms="${all_platforms} x86-win32-vs7"
|
||||
@@ -117,6 +123,7 @@ all_platforms="${all_platforms} x86-win32-vs9"
|
||||
all_platforms="${all_platforms} x86_64-darwin9-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin10-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin11-gcc"
|
||||
all_platforms="${all_platforms} x86_64-darwin12-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-icc"
|
||||
all_platforms="${all_platforms} x86_64-solaris-gcc"
|
||||
@@ -125,6 +132,9 @@ all_platforms="${all_platforms} x86_64-win64-vs8"
|
||||
all_platforms="${all_platforms} x86_64-win64-vs9"
|
||||
all_platforms="${all_platforms} universal-darwin8-gcc"
|
||||
all_platforms="${all_platforms} universal-darwin9-gcc"
|
||||
all_platforms="${all_platforms} universal-darwin10-gcc"
|
||||
all_platforms="${all_platforms} universal-darwin11-gcc"
|
||||
all_platforms="${all_platforms} universal-darwin12-gcc"
|
||||
all_platforms="${all_platforms} generic-gnu"
|
||||
|
||||
# all_targets is a list of all targets that can be configured
|
||||
@@ -163,6 +173,7 @@ enable md5
|
||||
enable spatial_resampling
|
||||
enable multithread
|
||||
enable os_support
|
||||
enable temporal_denoising
|
||||
|
||||
[ -d ${source_path}/../include ] && enable alt_tree_layout
|
||||
for d in vp8; do
|
||||
@@ -176,6 +187,8 @@ else
|
||||
# customer environment
|
||||
[ -f ${source_path}/../include/vpx/vp8cx.h ] && CODECS="${CODECS} vp8_encoder"
|
||||
[ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
|
||||
[ -f ${source_path}/../include/vpx/vp8cx.h ] || disable vp8_encoder
|
||||
[ -f ${source_path}/../include/vpx/vp8dx.h ] || disable vp8_decoder
|
||||
|
||||
[ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt
|
||||
fi
|
||||
@@ -192,11 +205,12 @@ ARCH_LIST="
|
||||
ppc64
|
||||
"
|
||||
ARCH_EXT_LIST="
|
||||
armv5te
|
||||
armv6
|
||||
armv7
|
||||
edsp
|
||||
media
|
||||
neon
|
||||
|
||||
mips32
|
||||
dspr2
|
||||
|
||||
mmx
|
||||
sse
|
||||
@@ -252,6 +266,7 @@ CONFIG_LIST="
|
||||
static_msvcrt
|
||||
spatial_resampling
|
||||
realtime_only
|
||||
onthefly_bitpacking
|
||||
error_concealment
|
||||
shared
|
||||
static
|
||||
@@ -260,6 +275,7 @@ CONFIG_LIST="
|
||||
os_support
|
||||
unit_tests
|
||||
multi_res_encoding
|
||||
temporal_denoising
|
||||
"
|
||||
CMDLINE_SELECT="
|
||||
extra_warnings
|
||||
@@ -278,6 +294,7 @@ CMDLINE_SELECT="
|
||||
|
||||
libs
|
||||
examples
|
||||
docs
|
||||
libc
|
||||
as
|
||||
fast_unaligned
|
||||
@@ -296,6 +313,7 @@ CMDLINE_SELECT="
|
||||
mem_tracker
|
||||
spatial_resampling
|
||||
realtime_only
|
||||
onthefly_bitpacking
|
||||
error_concealment
|
||||
shared
|
||||
static
|
||||
@@ -303,6 +321,7 @@ CMDLINE_SELECT="
|
||||
postproc_visualizer
|
||||
unit_tests
|
||||
multi_res_encoding
|
||||
temporal_denoising
|
||||
"
|
||||
|
||||
process_cmdline() {
|
||||
@@ -437,7 +456,13 @@ process_detect() {
|
||||
# Can only build shared libs on a subset of platforms. Doing this check
|
||||
# here rather than at option parse time because the target auto-detect
|
||||
# magic happens after the command line has been parsed.
|
||||
enabled linux || die "--enable-shared only supported on ELF for now"
|
||||
if ! enabled linux; then
|
||||
if enabled gnu; then
|
||||
echo "--enable-shared is only supported on ELF; assuming this is OK"
|
||||
else
|
||||
die "--enable-shared only supported on ELF for now"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -z "$CC" ]; then
|
||||
echo "Bypassing toolchain for environment detection."
|
||||
@@ -483,11 +508,20 @@ process_toolchain() {
|
||||
case $toolchain in
|
||||
universal-darwin*)
|
||||
local darwin_ver=${tgt_os##darwin}
|
||||
fat_bin_archs="$fat_bin_archs ppc32-${tgt_os}-gcc"
|
||||
|
||||
# Intel
|
||||
fat_bin_archs="$fat_bin_archs x86-${tgt_os}-${tgt_cc}"
|
||||
if [ $darwin_ver -gt 8 ]; then
|
||||
# Snow Leopard (10.6/darwin10) dropped support for PPC
|
||||
# Include PPC support for all prior versions
|
||||
if [ $darwin_ver -lt 10 ]; then
|
||||
fat_bin_archs="$fat_bin_archs ppc32-${tgt_os}-gcc"
|
||||
fi
|
||||
|
||||
# Tiger (10.4/darwin8) brought support for x86
|
||||
if [ $darwin_ver -ge 8 ]; then
|
||||
fat_bin_archs="$fat_bin_archs x86-${tgt_os}-${tgt_cc}"
|
||||
fi
|
||||
|
||||
# Leopard (10.5/darwin9) brought 64 bit support
|
||||
if [ $darwin_ver -ge 9 ]; then
|
||||
fat_bin_archs="$fat_bin_archs x86_64-${tgt_os}-${tgt_cc}"
|
||||
fi
|
||||
;;
|
||||
@@ -503,6 +537,10 @@ process_toolchain() {
|
||||
check_add_cflags -Wpointer-arith
|
||||
check_add_cflags -Wtype-limits
|
||||
check_add_cflags -Wcast-qual
|
||||
check_add_cflags -Wimplicit-function-declaration
|
||||
check_add_cflags -Wuninitialized
|
||||
check_add_cflags -Wunused-variable
|
||||
check_add_cflags -Wunused-but-set-variable
|
||||
enabled extra_warnings || check_add_cflags -Wno-unused-function
|
||||
fi
|
||||
|
||||
@@ -557,6 +595,25 @@ process_toolchain() {
|
||||
if enabled postproc_visualizer; then
|
||||
enabled postproc || die "postproc_visualizer requires postproc to be enabled"
|
||||
fi
|
||||
|
||||
# Enable unit tests if we have a working C++ compiler
|
||||
case "$toolchain" in
|
||||
*-vs*)
|
||||
soft_enable unit_tests
|
||||
;;
|
||||
*-android-*)
|
||||
# GTestLog must be modified to use Android logging utilities.
|
||||
;;
|
||||
*-darwin-*)
|
||||
# iOS/ARM builds do not work with gtest. This does not match
|
||||
# x86 targets.
|
||||
;;
|
||||
*)
|
||||
check_cxx "$@" <<EOF && soft_enable unit_tests
|
||||
int z;
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
|
3
docs.mk
3
docs.mk
@@ -21,9 +21,6 @@ CODEC_DOX := mainpage.dox \
|
||||
usage_dx.dox \
|
||||
|
||||
# Other doxy files sourced in Markdown
|
||||
TXT_DOX-$(CONFIG_VP8) += vp8_api1_migration.dox
|
||||
vp8_api1_migration.dox.DESC = VP8 API 1.x Migration
|
||||
|
||||
TXT_DOX = $(call enabled,TXT_DOX)
|
||||
|
||||
%.dox: %.txt
|
||||
|
11
examples.mk
11
examples.mk
@@ -32,6 +32,7 @@ vpxenc.SRCS += args.c args.h y4minput.c y4minput.h
|
||||
vpxenc.SRCS += tools_common.c tools_common.h
|
||||
vpxenc.SRCS += vpx_ports/mem_ops.h
|
||||
vpxenc.SRCS += vpx_ports/mem_ops_aligned.h
|
||||
vpxenc.SRCS += vpx_ports/vpx_timer.h
|
||||
vpxenc.SRCS += libmkv/EbmlIDs.h
|
||||
vpxenc.SRCS += libmkv/EbmlWriter.c
|
||||
vpxenc.SRCS += libmkv/EbmlWriter.h
|
||||
@@ -97,7 +98,7 @@ vp8cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
|
||||
vp8cx_set_ref.DESCRIPTION = VP8 set encoder reference frame
|
||||
|
||||
# C file is provided, not generated automatically.
|
||||
GEN_EXAMPLES-$(CONFIG_MULTI_RES_ENCODING) += vp8_multi_resolution_encoder.c
|
||||
UTILS-$(CONFIG_MULTI_RES_ENCODING) += vp8_multi_resolution_encoder.c
|
||||
vp8_multi_resolution_encoder.SRCS \
|
||||
+= third_party/libyuv/include/libyuv/basic_types.h \
|
||||
third_party/libyuv/include/libyuv/cpu_id.h \
|
||||
@@ -168,12 +169,12 @@ $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_OBJS,BUILD_OBJS):=yes)
|
||||
# Create build/install dependencies for all examples. The common case
|
||||
# is handled here. The MSVS case is handled below.
|
||||
NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
|
||||
DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=))
|
||||
INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=))
|
||||
DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
|
||||
INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
|
||||
DIST-SRCS-yes += $(ALL_SRCS)
|
||||
INSTALL-SRCS-yes += $(UTIL_SRCS)
|
||||
OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
|
||||
BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=))
|
||||
BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
|
||||
|
||||
|
||||
# Instantiate linker template for all examples.
|
||||
@@ -183,7 +184,7 @@ $(foreach bin,$(BINS-yes),\
|
||||
$(if $(BUILD_OBJS),$(eval $(bin):\
|
||||
$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF)))\
|
||||
$(if $(BUILD_OBJS),$(eval $(call linker_template,$(bin),\
|
||||
$(call objs,$($(notdir $(bin)).SRCS)) \
|
||||
$(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
|
||||
-l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
|
||||
)))\
|
||||
$(if $(LIPO_OBJS),$(eval $(call lipo_bin_template,$(bin))))\
|
||||
|
@@ -48,8 +48,8 @@ for(plane=0; plane < 3; plane++) {
|
||||
unsigned char *buf =img->planes[plane];
|
||||
|
||||
for(y=0; y < (plane ? (img->d_h + 1) >> 1 : img->d_h); y++) {
|
||||
if(fwrite(buf, 1, (plane ? (img->d_w + 1) >> 1 : img->d_w),
|
||||
outfile));
|
||||
(void) fwrite(buf, 1, (plane ? (img->d_w + 1) >> 1 : img->d_w),
|
||||
outfile);
|
||||
buf += img->stride[plane];
|
||||
}
|
||||
}
|
||||
|
@@ -85,7 +85,7 @@ static void write_ivf_file_header(FILE *outfile,
|
||||
mem_put_le32(header+24, frame_cnt); /* length */
|
||||
mem_put_le32(header+28, 0); /* unused */
|
||||
|
||||
if(fwrite(header, 1, 32, outfile));
|
||||
(void) fwrite(header, 1, 32, outfile);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ static void write_ivf_frame_header(FILE *outfile,
|
||||
mem_put_le32(header+4, pts&0xFFFFFFFF);
|
||||
mem_put_le32(header+8, pts >> 32);
|
||||
|
||||
if(fwrite(header, 1, 12, outfile));
|
||||
(void) fwrite(header, 1, 12, outfile);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
@@ -61,13 +61,14 @@ if(vpx_codec_encode(&codec, frame_avail? &raw : NULL, frame_cnt,
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_FRAME
|
||||
case VPX_CODEC_CX_FRAME_PKT:
|
||||
write_ivf_frame_header(outfile, pkt);
|
||||
if(fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz,
|
||||
outfile));
|
||||
(void) fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz,
|
||||
outfile);
|
||||
break;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_FRAME
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
|
||||
vpx_img_free(&raw);
|
||||
if(vpx_codec_destroy(&codec))
|
||||
die_codec(&codec, "Failed to destroy codec");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
|
||||
|
@@ -71,5 +71,17 @@ Pass Progress Reporting
|
||||
It's sometimes helpful to see when each pass completes.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TWOPASS_LOOP_END
|
||||
printf("Pass %d complete.\n", pass+1);
|
||||
if(vpx_codec_destroy(&codec))
|
||||
die_codec(&codec, "Failed to destroy codec");
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TWOPASS_LOOP_END
|
||||
|
||||
|
||||
Clean-up
|
||||
-----------------------------
|
||||
Destruction of the encoder instance must be done on each pass. The
|
||||
raw image should be destroyed at the end as usual.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
|
||||
vpx_img_free(&raw);
|
||||
free(stats.buf);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
|
||||
|
292
libmkv/EbmlIDs.h
292
libmkv/EbmlIDs.h
@@ -1,16 +1,16 @@
|
||||
// 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.
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef MKV_DEFS_HPP
|
||||
#define MKV_DEFS_HPP 1
|
||||
|
||||
//Commenting out values not available in webm, but available in matroska
|
||||
/* Commenting out values not available in webm, but available in matroska */
|
||||
|
||||
enum mkv
|
||||
{
|
||||
@@ -22,7 +22,7 @@ enum mkv
|
||||
DocType = 0x4282,
|
||||
DocTypeVersion = 0x4287,
|
||||
DocTypeReadVersion = 0x4285,
|
||||
// CRC_32 = 0xBF,
|
||||
/* CRC_32 = 0xBF, */
|
||||
Void = 0xEC,
|
||||
SignatureSlot = 0x1B538667,
|
||||
SignatureAlgo = 0x7E8A,
|
||||
@@ -32,61 +32,61 @@ enum mkv
|
||||
SignatureElements = 0x7E5B,
|
||||
SignatureElementList = 0x7E7B,
|
||||
SignedElement = 0x6532,
|
||||
//segment
|
||||
/* segment */
|
||||
Segment = 0x18538067,
|
||||
//Meta Seek Information
|
||||
/* Meta Seek Information */
|
||||
SeekHead = 0x114D9B74,
|
||||
Seek = 0x4DBB,
|
||||
SeekID = 0x53AB,
|
||||
SeekPosition = 0x53AC,
|
||||
//Segment Information
|
||||
/* Segment Information */
|
||||
Info = 0x1549A966,
|
||||
// SegmentUID = 0x73A4,
|
||||
// SegmentFilename = 0x7384,
|
||||
// PrevUID = 0x3CB923,
|
||||
// PrevFilename = 0x3C83AB,
|
||||
// NextUID = 0x3EB923,
|
||||
// NextFilename = 0x3E83BB,
|
||||
// SegmentFamily = 0x4444,
|
||||
// ChapterTranslate = 0x6924,
|
||||
// ChapterTranslateEditionUID = 0x69FC,
|
||||
// ChapterTranslateCodec = 0x69BF,
|
||||
// ChapterTranslateID = 0x69A5,
|
||||
/* SegmentUID = 0x73A4, */
|
||||
/* SegmentFilename = 0x7384, */
|
||||
/* PrevUID = 0x3CB923, */
|
||||
/* PrevFilename = 0x3C83AB, */
|
||||
/* NextUID = 0x3EB923, */
|
||||
/* NextFilename = 0x3E83BB, */
|
||||
/* SegmentFamily = 0x4444, */
|
||||
/* ChapterTranslate = 0x6924, */
|
||||
/* ChapterTranslateEditionUID = 0x69FC, */
|
||||
/* ChapterTranslateCodec = 0x69BF, */
|
||||
/* ChapterTranslateID = 0x69A5, */
|
||||
TimecodeScale = 0x2AD7B1,
|
||||
Segment_Duration = 0x4489,
|
||||
DateUTC = 0x4461,
|
||||
// Title = 0x7BA9,
|
||||
/* Title = 0x7BA9, */
|
||||
MuxingApp = 0x4D80,
|
||||
WritingApp = 0x5741,
|
||||
//Cluster
|
||||
/* Cluster */
|
||||
Cluster = 0x1F43B675,
|
||||
Timecode = 0xE7,
|
||||
// SilentTracks = 0x5854,
|
||||
// SilentTrackNumber = 0x58D7,
|
||||
// Position = 0xA7,
|
||||
/* SilentTracks = 0x5854, */
|
||||
/* SilentTrackNumber = 0x58D7, */
|
||||
/* Position = 0xA7, */
|
||||
PrevSize = 0xAB,
|
||||
BlockGroup = 0xA0,
|
||||
Block = 0xA1,
|
||||
// BlockVirtual = 0xA2,
|
||||
// BlockAdditions = 0x75A1,
|
||||
// BlockMore = 0xA6,
|
||||
// BlockAddID = 0xEE,
|
||||
// BlockAdditional = 0xA5,
|
||||
/* BlockVirtual = 0xA2, */
|
||||
/* BlockAdditions = 0x75A1, */
|
||||
/* BlockMore = 0xA6, */
|
||||
/* BlockAddID = 0xEE, */
|
||||
/* BlockAdditional = 0xA5, */
|
||||
BlockDuration = 0x9B,
|
||||
// ReferencePriority = 0xFA,
|
||||
/* ReferencePriority = 0xFA, */
|
||||
ReferenceBlock = 0xFB,
|
||||
// ReferenceVirtual = 0xFD,
|
||||
// CodecState = 0xA4,
|
||||
// Slices = 0x8E,
|
||||
// TimeSlice = 0xE8,
|
||||
/* ReferenceVirtual = 0xFD, */
|
||||
/* CodecState = 0xA4, */
|
||||
/* Slices = 0x8E, */
|
||||
/* TimeSlice = 0xE8, */
|
||||
LaceNumber = 0xCC,
|
||||
// FrameNumber = 0xCD,
|
||||
// BlockAdditionID = 0xCB,
|
||||
// MkvDelay = 0xCE,
|
||||
// Cluster_Duration = 0xCF,
|
||||
/* FrameNumber = 0xCD, */
|
||||
/* BlockAdditionID = 0xCB, */
|
||||
/* MkvDelay = 0xCE, */
|
||||
/* Cluster_Duration = 0xCF, */
|
||||
SimpleBlock = 0xA3,
|
||||
// EncryptedBlock = 0xAF,
|
||||
//Track
|
||||
/* EncryptedBlock = 0xAF, */
|
||||
/* Track */
|
||||
Tracks = 0x1654AE6B,
|
||||
TrackEntry = 0xAE,
|
||||
TrackNumber = 0xD7,
|
||||
@@ -96,28 +96,28 @@ enum mkv
|
||||
FlagDefault = 0x88,
|
||||
FlagForced = 0x55AA,
|
||||
FlagLacing = 0x9C,
|
||||
// MinCache = 0x6DE7,
|
||||
// MaxCache = 0x6DF8,
|
||||
/* MinCache = 0x6DE7, */
|
||||
/* MaxCache = 0x6DF8, */
|
||||
DefaultDuration = 0x23E383,
|
||||
// TrackTimecodeScale = 0x23314F,
|
||||
// TrackOffset = 0x537F,
|
||||
// MaxBlockAdditionID = 0x55EE,
|
||||
/* TrackTimecodeScale = 0x23314F, */
|
||||
/* TrackOffset = 0x537F, */
|
||||
/* MaxBlockAdditionID = 0x55EE, */
|
||||
Name = 0x536E,
|
||||
Language = 0x22B59C,
|
||||
CodecID = 0x86,
|
||||
CodecPrivate = 0x63A2,
|
||||
CodecName = 0x258688,
|
||||
// AttachmentLink = 0x7446,
|
||||
// CodecSettings = 0x3A9697,
|
||||
// CodecInfoURL = 0x3B4040,
|
||||
// CodecDownloadURL = 0x26B240,
|
||||
// CodecDecodeAll = 0xAA,
|
||||
// TrackOverlay = 0x6FAB,
|
||||
// TrackTranslate = 0x6624,
|
||||
// TrackTranslateEditionUID = 0x66FC,
|
||||
// TrackTranslateCodec = 0x66BF,
|
||||
// TrackTranslateTrackID = 0x66A5,
|
||||
//video
|
||||
/* AttachmentLink = 0x7446, */
|
||||
/* CodecSettings = 0x3A9697, */
|
||||
/* CodecInfoURL = 0x3B4040, */
|
||||
/* CodecDownloadURL = 0x26B240, */
|
||||
/* CodecDecodeAll = 0xAA, */
|
||||
/* TrackOverlay = 0x6FAB, */
|
||||
/* TrackTranslate = 0x6624, */
|
||||
/* TrackTranslateEditionUID = 0x66FC, */
|
||||
/* TrackTranslateCodec = 0x66BF, */
|
||||
/* TrackTranslateTrackID = 0x66A5, */
|
||||
/* video */
|
||||
Video = 0xE0,
|
||||
FlagInterlaced = 0x9A,
|
||||
StereoMode = 0x53B8,
|
||||
@@ -131,101 +131,101 @@ enum mkv
|
||||
DisplayHeight = 0x54BA,
|
||||
DisplayUnit = 0x54B2,
|
||||
AspectRatioType = 0x54B3,
|
||||
// ColourSpace = 0x2EB524,
|
||||
// GammaValue = 0x2FB523,
|
||||
/* ColourSpace = 0x2EB524, */
|
||||
/* GammaValue = 0x2FB523, */
|
||||
FrameRate = 0x2383E3,
|
||||
//end video
|
||||
//audio
|
||||
/* end video */
|
||||
/* audio */
|
||||
Audio = 0xE1,
|
||||
SamplingFrequency = 0xB5,
|
||||
OutputSamplingFrequency = 0x78B5,
|
||||
Channels = 0x9F,
|
||||
// ChannelPositions = 0x7D7B,
|
||||
/* ChannelPositions = 0x7D7B, */
|
||||
BitDepth = 0x6264,
|
||||
//end audio
|
||||
//content encoding
|
||||
// ContentEncodings = 0x6d80,
|
||||
// ContentEncoding = 0x6240,
|
||||
// ContentEncodingOrder = 0x5031,
|
||||
// ContentEncodingScope = 0x5032,
|
||||
// ContentEncodingType = 0x5033,
|
||||
// ContentCompression = 0x5034,
|
||||
// ContentCompAlgo = 0x4254,
|
||||
// ContentCompSettings = 0x4255,
|
||||
// ContentEncryption = 0x5035,
|
||||
// ContentEncAlgo = 0x47e1,
|
||||
// ContentEncKeyID = 0x47e2,
|
||||
// ContentSignature = 0x47e3,
|
||||
// ContentSigKeyID = 0x47e4,
|
||||
// ContentSigAlgo = 0x47e5,
|
||||
// ContentSigHashAlgo = 0x47e6,
|
||||
//end content encoding
|
||||
//Cueing Data
|
||||
/* end audio */
|
||||
/* content encoding */
|
||||
/* ContentEncodings = 0x6d80, */
|
||||
/* ContentEncoding = 0x6240, */
|
||||
/* ContentEncodingOrder = 0x5031, */
|
||||
/* ContentEncodingScope = 0x5032, */
|
||||
/* ContentEncodingType = 0x5033, */
|
||||
/* ContentCompression = 0x5034, */
|
||||
/* ContentCompAlgo = 0x4254, */
|
||||
/* ContentCompSettings = 0x4255, */
|
||||
/* ContentEncryption = 0x5035, */
|
||||
/* ContentEncAlgo = 0x47e1, */
|
||||
/* ContentEncKeyID = 0x47e2, */
|
||||
/* ContentSignature = 0x47e3, */
|
||||
/* ContentSigKeyID = 0x47e4, */
|
||||
/* ContentSigAlgo = 0x47e5, */
|
||||
/* ContentSigHashAlgo = 0x47e6, */
|
||||
/* end content encoding */
|
||||
/* Cueing Data */
|
||||
Cues = 0x1C53BB6B,
|
||||
CuePoint = 0xBB,
|
||||
CueTime = 0xB3,
|
||||
CueTrackPositions = 0xB7,
|
||||
CueTrack = 0xF7,
|
||||
CueClusterPosition = 0xF1,
|
||||
CueBlockNumber = 0x5378,
|
||||
// CueCodecState = 0xEA,
|
||||
// CueReference = 0xDB,
|
||||
// CueRefTime = 0x96,
|
||||
// CueRefCluster = 0x97,
|
||||
// CueRefNumber = 0x535F,
|
||||
// CueRefCodecState = 0xEB,
|
||||
//Attachment
|
||||
// Attachments = 0x1941A469,
|
||||
// AttachedFile = 0x61A7,
|
||||
// FileDescription = 0x467E,
|
||||
// FileName = 0x466E,
|
||||
// FileMimeType = 0x4660,
|
||||
// FileData = 0x465C,
|
||||
// FileUID = 0x46AE,
|
||||
// FileReferral = 0x4675,
|
||||
//Chapters
|
||||
// Chapters = 0x1043A770,
|
||||
// EditionEntry = 0x45B9,
|
||||
// EditionUID = 0x45BC,
|
||||
// EditionFlagHidden = 0x45BD,
|
||||
// EditionFlagDefault = 0x45DB,
|
||||
// EditionFlagOrdered = 0x45DD,
|
||||
// ChapterAtom = 0xB6,
|
||||
// ChapterUID = 0x73C4,
|
||||
// ChapterTimeStart = 0x91,
|
||||
// ChapterTimeEnd = 0x92,
|
||||
// ChapterFlagHidden = 0x98,
|
||||
// ChapterFlagEnabled = 0x4598,
|
||||
// ChapterSegmentUID = 0x6E67,
|
||||
// ChapterSegmentEditionUID = 0x6EBC,
|
||||
// ChapterPhysicalEquiv = 0x63C3,
|
||||
// ChapterTrack = 0x8F,
|
||||
// ChapterTrackNumber = 0x89,
|
||||
// ChapterDisplay = 0x80,
|
||||
// ChapString = 0x85,
|
||||
// ChapLanguage = 0x437C,
|
||||
// ChapCountry = 0x437E,
|
||||
// ChapProcess = 0x6944,
|
||||
// ChapProcessCodecID = 0x6955,
|
||||
// ChapProcessPrivate = 0x450D,
|
||||
// ChapProcessCommand = 0x6911,
|
||||
// ChapProcessTime = 0x6922,
|
||||
// ChapProcessData = 0x6933,
|
||||
//Tagging
|
||||
// Tags = 0x1254C367,
|
||||
// Tag = 0x7373,
|
||||
// Targets = 0x63C0,
|
||||
// TargetTypeValue = 0x68CA,
|
||||
// TargetType = 0x63CA,
|
||||
// Tagging_TrackUID = 0x63C5,
|
||||
// Tagging_EditionUID = 0x63C9,
|
||||
// Tagging_ChapterUID = 0x63C4,
|
||||
// AttachmentUID = 0x63C6,
|
||||
// SimpleTag = 0x67C8,
|
||||
// TagName = 0x45A3,
|
||||
// TagLanguage = 0x447A,
|
||||
// TagDefault = 0x4484,
|
||||
// TagString = 0x4487,
|
||||
// TagBinary = 0x4485,
|
||||
CueBlockNumber = 0x5378
|
||||
/* CueCodecState = 0xEA, */
|
||||
/* CueReference = 0xDB, */
|
||||
/* CueRefTime = 0x96, */
|
||||
/* CueRefCluster = 0x97, */
|
||||
/* CueRefNumber = 0x535F, */
|
||||
/* CueRefCodecState = 0xEB, */
|
||||
/* Attachment */
|
||||
/* Attachments = 0x1941A469, */
|
||||
/* AttachedFile = 0x61A7, */
|
||||
/* FileDescription = 0x467E, */
|
||||
/* FileName = 0x466E, */
|
||||
/* FileMimeType = 0x4660, */
|
||||
/* FileData = 0x465C, */
|
||||
/* FileUID = 0x46AE, */
|
||||
/* FileReferral = 0x4675, */
|
||||
/* Chapters */
|
||||
/* Chapters = 0x1043A770, */
|
||||
/* EditionEntry = 0x45B9, */
|
||||
/* EditionUID = 0x45BC, */
|
||||
/* EditionFlagHidden = 0x45BD, */
|
||||
/* EditionFlagDefault = 0x45DB, */
|
||||
/* EditionFlagOrdered = 0x45DD, */
|
||||
/* ChapterAtom = 0xB6, */
|
||||
/* ChapterUID = 0x73C4, */
|
||||
/* ChapterTimeStart = 0x91, */
|
||||
/* ChapterTimeEnd = 0x92, */
|
||||
/* ChapterFlagHidden = 0x98, */
|
||||
/* ChapterFlagEnabled = 0x4598, */
|
||||
/* ChapterSegmentUID = 0x6E67, */
|
||||
/* ChapterSegmentEditionUID = 0x6EBC, */
|
||||
/* ChapterPhysicalEquiv = 0x63C3, */
|
||||
/* ChapterTrack = 0x8F, */
|
||||
/* ChapterTrackNumber = 0x89, */
|
||||
/* ChapterDisplay = 0x80, */
|
||||
/* ChapString = 0x85, */
|
||||
/* ChapLanguage = 0x437C, */
|
||||
/* ChapCountry = 0x437E, */
|
||||
/* ChapProcess = 0x6944, */
|
||||
/* ChapProcessCodecID = 0x6955, */
|
||||
/* ChapProcessPrivate = 0x450D, */
|
||||
/* ChapProcessCommand = 0x6911, */
|
||||
/* ChapProcessTime = 0x6922, */
|
||||
/* ChapProcessData = 0x6933, */
|
||||
/* Tagging */
|
||||
/* Tags = 0x1254C367, */
|
||||
/* Tag = 0x7373, */
|
||||
/* Targets = 0x63C0, */
|
||||
/* TargetTypeValue = 0x68CA, */
|
||||
/* TargetType = 0x63CA, */
|
||||
/* Tagging_TrackUID = 0x63C5, */
|
||||
/* Tagging_EditionUID = 0x63C9, */
|
||||
/* Tagging_ChapterUID = 0x63C4, */
|
||||
/* AttachmentUID = 0x63C6, */
|
||||
/* SimpleTag = 0x67C8, */
|
||||
/* TagName = 0x45A3, */
|
||||
/* TagLanguage = 0x447A, */
|
||||
/* TagDefault = 0x4484, */
|
||||
/* TagString = 0x4487, */
|
||||
/* TagBinary = 0x4485, */
|
||||
};
|
||||
#endif
|
||||
|
@@ -1,12 +1,12 @@
|
||||
// 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.
|
||||
|
||||
|
||||
/*
|
||||
* 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 "EbmlWriter.h"
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
@@ -18,11 +18,13 @@
|
||||
#define LITERALU64(n) n##LLU
|
||||
#endif
|
||||
|
||||
void Ebml_WriteLen(EbmlGlobal *glob, long long val)
|
||||
void Ebml_WriteLen(EbmlGlobal *glob, int64_t val)
|
||||
{
|
||||
//TODO check and make sure we are not > than 0x0100000000000000LLU
|
||||
unsigned char size = 8; //size in bytes to output
|
||||
unsigned long long minVal = LITERALU64(0x00000000000000ff); //mask to compare for byte size
|
||||
/* TODO check and make sure we are not > than 0x0100000000000000LLU */
|
||||
unsigned char size = 8; /* size in bytes to output */
|
||||
|
||||
/* mask to compare for byte size */
|
||||
int64_t minVal = 0xff;
|
||||
|
||||
for (size = 1; size < 8; size ++)
|
||||
{
|
||||
@@ -32,7 +34,7 @@ void Ebml_WriteLen(EbmlGlobal *glob, long long val)
|
||||
minVal = (minVal << 7);
|
||||
}
|
||||
|
||||
val |= (LITERALU64(0x000000000000080) << ((size - 1) * 7));
|
||||
val |= (((uint64_t)0x80) << ((size - 1) * 7));
|
||||
|
||||
Ebml_Serialize(glob, (void *) &val, sizeof(val), size);
|
||||
}
|
||||
@@ -40,23 +42,25 @@ void Ebml_WriteLen(EbmlGlobal *glob, long long val)
|
||||
void Ebml_WriteString(EbmlGlobal *glob, const char *str)
|
||||
{
|
||||
const size_t size_ = strlen(str);
|
||||
const unsigned long long size = size_;
|
||||
const uint64_t size = size_;
|
||||
Ebml_WriteLen(glob, size);
|
||||
//TODO: it's not clear from the spec whether the nul terminator
|
||||
//should be serialized too. For now we omit the null terminator.
|
||||
Ebml_Write(glob, str, size);
|
||||
/* TODO: it's not clear from the spec whether the nul terminator
|
||||
* should be serialized too. For now we omit the null terminator.
|
||||
*/
|
||||
Ebml_Write(glob, str, (unsigned long)size);
|
||||
}
|
||||
|
||||
void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr)
|
||||
{
|
||||
const size_t strlen = wcslen(wstr);
|
||||
|
||||
//TODO: it's not clear from the spec whether the nul terminator
|
||||
//should be serialized too. For now we include it.
|
||||
const unsigned long long size = strlen;
|
||||
/* TODO: it's not clear from the spec whether the nul terminator
|
||||
* should be serialized too. For now we include it.
|
||||
*/
|
||||
const uint64_t size = strlen;
|
||||
|
||||
Ebml_WriteLen(glob, size);
|
||||
Ebml_Write(glob, wstr, size);
|
||||
Ebml_Write(glob, wstr, (unsigned long)size);
|
||||
}
|
||||
|
||||
void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id)
|
||||
@@ -85,12 +89,12 @@ void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t
|
||||
|
||||
void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui)
|
||||
{
|
||||
unsigned char size = 8; //size in bytes to output
|
||||
unsigned char size = 8; /* size in bytes to output */
|
||||
unsigned char sizeSerialized = 0;
|
||||
unsigned long minVal;
|
||||
|
||||
Ebml_WriteID(glob, class_id);
|
||||
minVal = 0x7fLU; //mask to compare for byte size
|
||||
minVal = 0x7fLU; /* mask to compare for byte size */
|
||||
|
||||
for (size = 1; size < 4; size ++)
|
||||
{
|
||||
@@ -106,7 +110,7 @@ void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned l
|
||||
Ebml_Serialize(glob, &sizeSerialized, sizeof(sizeSerialized), 1);
|
||||
Ebml_Serialize(glob, &ui, sizeof(ui), size);
|
||||
}
|
||||
//TODO: perhaps this is a poor name for this id serializer helper function
|
||||
/* TODO: perhaps this is a poor name for this id serializer helper function */
|
||||
void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long bin)
|
||||
{
|
||||
int size;
|
||||
@@ -168,4 +172,4 @@ void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize)
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Serialize Date
|
||||
/* TODO Serialize Date */
|
||||
|
@@ -1,26 +1,30 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef EBMLWRITER_HPP
|
||||
#define EBMLWRITER_HPP
|
||||
|
||||
// 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.
|
||||
|
||||
//note: you must define write and serialize functions as well as your own EBML_GLOBAL
|
||||
//These functions MUST be implemented
|
||||
#include <stddef.h>
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
/* note: you must define write and serialize functions as well as your own
|
||||
* EBML_GLOBAL
|
||||
*
|
||||
* These functions MUST be implemented
|
||||
*/
|
||||
|
||||
typedef struct EbmlGlobal EbmlGlobal;
|
||||
void Ebml_Serialize(EbmlGlobal *glob, const void *, int, unsigned long);
|
||||
void Ebml_Write(EbmlGlobal *glob, const void *, unsigned long);
|
||||
/////
|
||||
|
||||
/*****/
|
||||
|
||||
void Ebml_WriteLen(EbmlGlobal *glob, long long val);
|
||||
void Ebml_WriteLen(EbmlGlobal *glob, int64_t val);
|
||||
void Ebml_WriteString(EbmlGlobal *glob, const char *str);
|
||||
void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr);
|
||||
void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id);
|
||||
@@ -28,11 +32,11 @@ void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t
|
||||
void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
|
||||
void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
|
||||
void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d);
|
||||
//TODO make this more generic to signed
|
||||
/* TODO make this more generic to signed */
|
||||
void Ebml_WriteSigned16(EbmlGlobal *glob, short val);
|
||||
void Ebml_SerializeString(EbmlGlobal *glob, unsigned long class_id, const char *s);
|
||||
void Ebml_SerializeUTF8(EbmlGlobal *glob, unsigned long class_id, wchar_t *s);
|
||||
void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char *data, unsigned long data_length);
|
||||
void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize);
|
||||
//TODO need date function
|
||||
/* TODO need date function */
|
||||
#endif
|
||||
|
180
libs.mk
180
libs.mk
@@ -17,10 +17,19 @@ else
|
||||
ASM:=.asm
|
||||
endif
|
||||
|
||||
CODEC_SRCS-yes += CHANGELOG
|
||||
CODEC_SRCS-yes += libs.mk
|
||||
|
||||
# If this is a universal (fat) binary, then all the subarchitectures have
|
||||
# already been built and our job is to stitch them together. The
|
||||
# BUILD_LIBVPX variable indicates whether we should be building
|
||||
# (compiling, linking) the library. The LIPO_LIBVPX variable indicates
|
||||
# that we're stitching.
|
||||
$(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
|
||||
|
||||
include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
|
||||
CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
|
||||
CODEC_DOC_SRCS += $(addprefix vpx/,$(call enabled,API_DOC_SRCS))
|
||||
|
||||
include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
|
||||
CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
|
||||
@@ -28,17 +37,17 @@ CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
|
||||
include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
|
||||
CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
|
||||
|
||||
include $(SRC_PATH_BARE)/vpx_ports/vpx_ports.mk
|
||||
CODEC_SRCS-yes += $(addprefix vpx_ports/,$(call enabled,PORTS_SRCS))
|
||||
|
||||
|
||||
ifeq ($(CONFIG_VP8_ENCODER),yes)
|
||||
VP8_PREFIX=vp8/
|
||||
include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
|
||||
CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
|
||||
CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
|
||||
CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h vpx/vp8e.h
|
||||
CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp8cx_arm.mk
|
||||
INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8e.h include/vpx/vp8cx.h
|
||||
INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
|
||||
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
|
||||
CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
|
||||
CODEC_DOC_SECTIONS += vp8 vp8_encoder
|
||||
endif
|
||||
|
||||
@@ -47,11 +56,8 @@ ifeq ($(CONFIG_VP8_DECODER),yes)
|
||||
include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
|
||||
CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
|
||||
CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
|
||||
CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk vpx/vp8.h vpx/vp8dx.h
|
||||
CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp8dx_arm.mk
|
||||
INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
|
||||
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
|
||||
CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
|
||||
CODEC_DOC_SECTIONS += vp8 vp8_decoder
|
||||
endif
|
||||
|
||||
@@ -66,6 +72,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_MSVS),yes)
|
||||
CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
|
||||
GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
|
||||
# This variable uses deferred expansion intentionally, since the results of
|
||||
# $(wildcard) may change during the course of the Make.
|
||||
VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
|
||||
@@ -82,28 +89,10 @@ INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
|
||||
INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
|
||||
endif
|
||||
|
||||
# If this is a universal (fat) binary, then all the subarchitectures have
|
||||
# already been built and our job is to stitch them together. The
|
||||
# BUILD_LIBVPX variable indicates whether we should be building
|
||||
# (compiling, linking) the library. The LIPO_LIBVPX variable indicates
|
||||
# that we're stitching.
|
||||
$(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
|
||||
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx/vpx_integer.h
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/asm_offsets.h
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_timer.h
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem.h
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += build/make/rtcd.sh
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
|
||||
INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
|
||||
ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/emms.asm
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86.h
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_abi_support.asm
|
||||
CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_cpuid.c
|
||||
endif
|
||||
CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm_cpudetect.c
|
||||
CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm.h
|
||||
CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
|
||||
CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
|
||||
CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
|
||||
@@ -114,7 +103,6 @@ INSTALL-LIBS-yes += include/vpx/vpx_integer.h
|
||||
INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
|
||||
INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
|
||||
INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
|
||||
INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
|
||||
INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
|
||||
ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
|
||||
ifeq ($(CONFIG_MSVS),yes)
|
||||
@@ -146,7 +134,7 @@ ifeq ($(CONFIG_MSVS),yes)
|
||||
obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
|
||||
@cp $(SRC_PATH_BARE)/build/x86-msvs/obj_int_extract.bat .
|
||||
@echo " [CREATE] $@"
|
||||
$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
|
||||
$(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
|
||||
--exe \
|
||||
--target=$(TOOLCHAIN) \
|
||||
--name=obj_int_extract \
|
||||
@@ -162,14 +150,14 @@ PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.bat
|
||||
|
||||
vpx.def: $(call enabled,CODEC_EXPORTS)
|
||||
@echo " [CREATE] $@"
|
||||
$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
|
||||
$(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
|
||||
--name=vpx\
|
||||
--out=$@ $^
|
||||
CLEAN-OBJS += vpx.def
|
||||
|
||||
vpx.vcproj: $(CODEC_SRCS) vpx.def
|
||||
@echo " [CREATE] $@"
|
||||
$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
|
||||
$(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
|
||||
--lib \
|
||||
--target=$(TOOLCHAIN) \
|
||||
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
|
||||
@@ -183,6 +171,7 @@ vpx.vcproj: $(CODEC_SRCS) vpx.def
|
||||
PROJECTS-$(BUILD_LIBVPX) += vpx.vcproj
|
||||
|
||||
vpx.vcproj: vpx_config.asm
|
||||
vpx.vcproj: vpx_rtcd.h
|
||||
|
||||
endif
|
||||
else
|
||||
@@ -232,7 +221,7 @@ vpx.pc: config.mk libs.mk
|
||||
$(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
|
||||
$(qexec)echo 'prefix=$(PREFIX)' >> $@
|
||||
$(qexec)echo 'exec_prefix=$${prefix}' >> $@
|
||||
$(qexec)echo 'libdir=$${prefix}/lib' >> $@
|
||||
$(qexec)echo 'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
|
||||
$(qexec)echo 'includedir=$${prefix}/include' >> $@
|
||||
$(qexec)echo '' >> $@
|
||||
$(qexec)echo 'Name: vpx' >> $@
|
||||
@@ -241,6 +230,7 @@ vpx.pc: config.mk libs.mk
|
||||
$(qexec)echo 'Requires:' >> $@
|
||||
$(qexec)echo 'Conflicts:' >> $@
|
||||
$(qexec)echo 'Libs: -L$${libdir} -lvpx' >> $@
|
||||
$(qexec)echo 'Libs.private: -lm -lpthread' >> $@
|
||||
$(qexec)echo 'Cflags: -I$${includedir}' >> $@
|
||||
INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
|
||||
INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
|
||||
@@ -279,40 +269,48 @@ $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
|
||||
# Calculate platform- and compiler-specific offsets for hand coded assembly
|
||||
#
|
||||
|
||||
OFFSET_PATTERN:='^[a-zA-Z0-9_]* EQU'
|
||||
|
||||
ifeq ($(filter icc gcc,$(TGT_CC)), $(TGT_CC))
|
||||
$(BUILD_PFX)asm_com_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S
|
||||
grep -w EQU $< | tr -d '$$\#' $(ADS2GAS) > $@
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)LC_ALL=C grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
|
||||
$(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S: $(VP8_PREFIX)common/asm_com_offsets.c
|
||||
CLEAN-OBJS += $(BUILD_PFX)asm_com_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S
|
||||
|
||||
$(BUILD_PFX)asm_enc_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S
|
||||
grep -w EQU $< | tr -d '$$\#' $(ADS2GAS) > $@
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)LC_ALL=C grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
|
||||
$(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S: $(VP8_PREFIX)encoder/asm_enc_offsets.c
|
||||
CLEAN-OBJS += $(BUILD_PFX)asm_enc_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S
|
||||
|
||||
$(BUILD_PFX)asm_dec_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S
|
||||
grep -w EQU $< | tr -d '$$\#' $(ADS2GAS) > $@
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)LC_ALL=C grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
|
||||
$(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S: $(VP8_PREFIX)decoder/asm_dec_offsets.c
|
||||
CLEAN-OBJS += $(BUILD_PFX)asm_dec_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S
|
||||
else
|
||||
ifeq ($(filter rvct,$(TGT_CC)), $(TGT_CC))
|
||||
asm_com_offsets.asm: obj_int_extract
|
||||
asm_com_offsets.asm: $(VP8_PREFIX)common/asm_com_offsets.c.o
|
||||
./obj_int_extract rvds $< $(ADS2GAS) > $@
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)./obj_int_extract rvds $< $(ADS2GAS) > $@
|
||||
OBJS-yes += $(VP8_PREFIX)common/asm_com_offsets.c.o
|
||||
CLEAN-OBJS += asm_com_offsets.asm
|
||||
$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_com_offsets.asm
|
||||
|
||||
asm_enc_offsets.asm: obj_int_extract
|
||||
asm_enc_offsets.asm: $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
|
||||
./obj_int_extract rvds $< $(ADS2GAS) > $@
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)./obj_int_extract rvds $< $(ADS2GAS) > $@
|
||||
OBJS-yes += $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
|
||||
CLEAN-OBJS += asm_enc_offsets.asm
|
||||
$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_enc_offsets.asm
|
||||
|
||||
asm_dec_offsets.asm: obj_int_extract
|
||||
asm_dec_offsets.asm: $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
|
||||
./obj_int_extract rvds $< $(ADS2GAS) > $@
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)./obj_int_extract rvds $< $(ADS2GAS) > $@
|
||||
OBJS-yes += $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
|
||||
CLEAN-OBJS += asm_dec_offsets.asm
|
||||
$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_dec_offsets.asm
|
||||
@@ -322,25 +320,54 @@ endif
|
||||
$(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
|
||||
CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
|
||||
|
||||
CODEC_DOC_SRCS += vpx/vpx_codec.h \
|
||||
vpx/vpx_decoder.h \
|
||||
vpx/vpx_encoder.h \
|
||||
vpx/vpx_image.h
|
||||
#
|
||||
# Rule to generate runtime cpu detection files
|
||||
#
|
||||
$(BUILD_PFX)vpx_rtcd.h: $(SRC_PATH_BARE)/$(sort $(filter %rtcd_defs.sh,$(CODEC_SRCS)))
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)$(SRC_PATH_BARE)/build/make/rtcd.sh --arch=$(TGT_ISA) \
|
||||
--sym=vpx_rtcd \
|
||||
--config=$(target)$(if $(FAT_ARCHS),,-$(TOOLCHAIN)).mk \
|
||||
$(RTCD_OPTIONS) $^ > $@
|
||||
CLEAN-OBJS += $(BUILD_PFX)vpx_rtcd.h
|
||||
|
||||
##
|
||||
## libvpx test directives
|
||||
##
|
||||
|
||||
ifeq ($(CONFIG_UNIT_TESTS),yes)
|
||||
LIBVPX_TEST_DATA_PATH ?= .
|
||||
|
||||
include $(SRC_PATH_BARE)/test/test.mk
|
||||
LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
|
||||
LIBVPX_TEST_BINS=./test_libvpx
|
||||
LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
|
||||
$(call enabled,LIBVPX_TEST_DATA))
|
||||
libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1)
|
||||
|
||||
$(LIBVPX_TEST_DATA):
|
||||
@echo " [DOWNLOAD] $@"
|
||||
$(qexec)trap 'rm -f $@' INT TERM &&\
|
||||
curl -L -o $@ $(call libvpx_test_data_url,$(@F))
|
||||
|
||||
testdata:: $(LIBVPX_TEST_DATA)
|
||||
$(qexec)if [ -x "$$(which sha1sum)" ]; then\
|
||||
echo "Checking test data:";\
|
||||
if [ -n "$(LIBVPX_TEST_DATA)" ]; then\
|
||||
for f in $(call enabled,LIBVPX_TEST_DATA); do\
|
||||
grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
|
||||
(cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c);\
|
||||
done; \
|
||||
fi; \
|
||||
else\
|
||||
echo "Skipping test data integrity check, sha1sum not found.";\
|
||||
fi
|
||||
|
||||
ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
|
||||
ifeq ($(CONFIG_MSVS),yes)
|
||||
|
||||
LIBVPX_TEST_SRCS=$(filter %_test.cc,$(call enabled,CODEC_SRCS))
|
||||
LIBVPX_TEST_BINS=$(sort $(LIBVPX_TEST_SRCS:.cc.o=))
|
||||
|
||||
gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
|
||||
@echo " [CREATE] $@"
|
||||
$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
|
||||
$(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
|
||||
--lib \
|
||||
--target=$(TOOLCHAIN) \
|
||||
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
|
||||
@@ -353,27 +380,22 @@ gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
|
||||
|
||||
PROJECTS-$(CONFIG_MSVS) += gtest.vcproj
|
||||
|
||||
define unit_test_vcproj_template
|
||||
$(notdir $(1:.cc=.vcproj)): $(SRC_PATH_BARE)/$(1)
|
||||
@echo " [vcproj] $$@"
|
||||
$$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh\
|
||||
--exe\
|
||||
--target=$$(TOOLCHAIN)\
|
||||
--name=$(notdir $(1:.cc=))\
|
||||
--ver=$$(CONFIG_VS_VERSION)\
|
||||
$$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
|
||||
--out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
|
||||
test_libvpx.vcproj: $(LIBVPX_TEST_SRCS)
|
||||
@echo " [CREATE] $@"
|
||||
$(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
|
||||
--exe \
|
||||
--target=$(TOOLCHAIN) \
|
||||
--name=test_libvpx \
|
||||
--proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
|
||||
--ver=$(CONFIG_VS_VERSION) \
|
||||
$(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
|
||||
--out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
|
||||
-I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
|
||||
-L. -lvpxmt -lwinmm -lgtestmt $$^
|
||||
endef
|
||||
-L. -l$(CODEC_LIB) -lwinmm -l$(GTEST_LIB) $^
|
||||
|
||||
$(foreach proj,$(LIBVPX_TEST_BINS),\
|
||||
$(eval $(call unit_test_vcproj_template,$(proj))))
|
||||
PROJECTS-$(CONFIG_MSVS) += test_libvpx.vcproj
|
||||
|
||||
PROJECTS-$(CONFIG_MSVS) += $(foreach proj,$(LIBVPX_TEST_BINS),\
|
||||
$(notdir $(proj:.cc=.vcproj)))
|
||||
|
||||
test::
|
||||
test:: testdata
|
||||
@set -e; for t in $(addprefix Win32/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done
|
||||
endif
|
||||
else
|
||||
@@ -381,28 +403,35 @@ else
|
||||
include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
|
||||
GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
|
||||
GTEST_OBJS=$(call objs,$(GTEST_SRCS))
|
||||
$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
|
||||
$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
|
||||
$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
|
||||
$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
|
||||
OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
|
||||
LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
|
||||
$(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)
|
||||
|
||||
LIBVPX_TEST_SRCS=$(filter %_test.cc,$(call enabled,CODEC_SRCS))
|
||||
LIBVPX_TEST_OBJS=$(call objs,$(LIBVPX_TEST_SRCS))
|
||||
$(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
|
||||
$(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
|
||||
LIBVPX_TEST_BINS=$(sort $(LIBVPX_TEST_OBJS:.cc.o=))
|
||||
LIBVPX_TEST_OBJS=$(sort $(call objs,$(LIBVPX_TEST_SRCS)))
|
||||
$(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
|
||||
$(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
|
||||
OBJS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_OBJS)
|
||||
BINS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_BINS)
|
||||
|
||||
# Install test sources only if codec source is included
|
||||
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
|
||||
$(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
|
||||
INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
|
||||
|
||||
CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
|
||||
CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
|
||||
$(foreach bin,$(LIBVPX_TEST_BINS),\
|
||||
$(if $(BUILD_LIBVPX),$(eval $(bin): libvpx.a libgtest.a ))\
|
||||
$(if $(BUILD_LIBVPX),$(eval $(bin): \
|
||||
lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
|
||||
$(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
|
||||
$(bin).cc.o \
|
||||
$(LIBVPX_TEST_OBJS) \
|
||||
-L. -lvpx -lgtest -lpthread -lm)\
|
||||
)))\
|
||||
$(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
|
||||
|
||||
test:: $(LIBVPX_TEST_BINS)
|
||||
test:: $(LIBVPX_TEST_BINS) testdata
|
||||
@set -e; for t in $(LIBVPX_TEST_BINS); do $$t; done
|
||||
|
||||
endif
|
||||
@@ -420,3 +449,6 @@ libs.doxy: $(CODEC_DOC_SRCS)
|
||||
@echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
|
||||
@echo "INCLUDE_PATH += ." >> $@;
|
||||
@echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
|
||||
|
||||
## Generate vpx_rtcd.h for all objects
|
||||
$(OBJS-yes:.o=.d): $(BUILD_PFX)vpx_rtcd.h
|
||||
|
16
mainpage.dox
16
mainpage.dox
@@ -12,8 +12,12 @@
|
||||
|
||||
This distribution of the WebM VP8 Codec SDK includes the following support:
|
||||
|
||||
\if vp8_encoder - \ref vp8_encoder \endif
|
||||
\if vp8_decoder - \ref vp8_decoder \endif
|
||||
\if vp8_encoder
|
||||
- \ref vp8_encoder
|
||||
\endif
|
||||
\if vp8_decoder
|
||||
- \ref vp8_decoder
|
||||
\endif
|
||||
|
||||
|
||||
\section main_startpoints Starting Points
|
||||
@@ -24,8 +28,12 @@
|
||||
- Read the \ref samples "sample code" for examples of how to interact with the
|
||||
codec.
|
||||
- \ref codec reference
|
||||
\if encoder - \ref encoder reference \endif
|
||||
\if decoder - \ref decoder reference \endif
|
||||
\if encoder
|
||||
- \ref encoder reference
|
||||
\endif
|
||||
\if decoder
|
||||
- \ref decoder reference
|
||||
\endif
|
||||
|
||||
\section main_support Support Options & FAQ
|
||||
The WebM project is an open source project supported by its community. For
|
||||
|
@@ -1272,7 +1272,7 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
|
||||
if (total > block_size)
|
||||
return -1;
|
||||
|
||||
entry = ne_find_track_entry(ctx, track - 1);
|
||||
entry = ne_find_track_entry(ctx, (unsigned int)(track - 1));
|
||||
if (!entry)
|
||||
return -1;
|
||||
|
||||
@@ -1291,7 +1291,7 @@ ne_read_block(nestegg * ctx, uint64_t block_id, uint64_t block_size, nestegg_pac
|
||||
|
||||
pkt = ne_alloc(sizeof(*pkt));
|
||||
pkt->track = track - 1;
|
||||
pkt->timecode = abs_timecode * tc_scale * track_scale;
|
||||
pkt->timecode = (uint64_t)(abs_timecode * tc_scale * track_scale);
|
||||
|
||||
ctx->log(ctx, NESTEGG_LOG_DEBUG, "%sblock t %lld pts %f f %llx frames: %llu",
|
||||
block_id == ID_BLOCK ? "" : "simple", pkt->track, pkt->timecode / 1e9, flags, frames);
|
||||
@@ -1774,35 +1774,35 @@ nestegg_track_video_params(nestegg * ctx, unsigned int track,
|
||||
|
||||
if (ne_get_uint(entry->video.pixel_width, &value) != 0)
|
||||
return -1;
|
||||
params->width = value;
|
||||
params->width = (unsigned int)value;
|
||||
|
||||
if (ne_get_uint(entry->video.pixel_height, &value) != 0)
|
||||
return -1;
|
||||
params->height = value;
|
||||
params->height = (unsigned int)value;
|
||||
|
||||
value = 0;
|
||||
ne_get_uint(entry->video.pixel_crop_bottom, &value);
|
||||
params->crop_bottom = value;
|
||||
params->crop_bottom = (unsigned int)value;
|
||||
|
||||
value = 0;
|
||||
ne_get_uint(entry->video.pixel_crop_top, &value);
|
||||
params->crop_top = value;
|
||||
params->crop_top = (unsigned int)value;
|
||||
|
||||
value = 0;
|
||||
ne_get_uint(entry->video.pixel_crop_left, &value);
|
||||
params->crop_left = value;
|
||||
params->crop_left = (unsigned int)value;
|
||||
|
||||
value = 0;
|
||||
ne_get_uint(entry->video.pixel_crop_right, &value);
|
||||
params->crop_right = value;
|
||||
params->crop_right = (unsigned int)value;
|
||||
|
||||
value = params->width;
|
||||
ne_get_uint(entry->video.display_width, &value);
|
||||
params->display_width = value;
|
||||
params->display_width = (unsigned int)value;
|
||||
|
||||
value = params->height;
|
||||
ne_get_uint(entry->video.display_height, &value);
|
||||
params->display_height = value;
|
||||
params->display_height = (unsigned int)value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1828,11 +1828,11 @@ nestegg_track_audio_params(nestegg * ctx, unsigned int track,
|
||||
|
||||
value = 1;
|
||||
ne_get_uint(entry->audio.channels, &value);
|
||||
params->channels = value;
|
||||
params->channels = (unsigned int)value;
|
||||
|
||||
value = 16;
|
||||
ne_get_uint(entry->audio.bit_depth, &value);
|
||||
params->depth = value;
|
||||
params->depth = (unsigned int)value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1888,7 +1888,7 @@ nestegg_free_packet(nestegg_packet * pkt)
|
||||
int
|
||||
nestegg_packet_track(nestegg_packet * pkt, unsigned int * track)
|
||||
{
|
||||
*track = pkt->track;
|
||||
*track = (unsigned int)pkt->track;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
17
solution.mk
17
solution.mk
@@ -8,18 +8,19 @@
|
||||
## be found in the AUTHORS file in the root of the source tree.
|
||||
##
|
||||
|
||||
# libvpx reverse dependencies (targets that depend on libvpx)
|
||||
VPX_NONDEPS=$(addsuffix .vcproj,vpx gtest obj_int_extract)
|
||||
VPX_RDEPS=$(foreach vcp,\
|
||||
$(filter-out $(VPX_NONDEPS),$^), --dep=$(vcp:.vcproj=):vpx)
|
||||
|
||||
vpx.sln: $(wildcard *.vcproj)
|
||||
@echo " [CREATE] $@"
|
||||
$(SRC_PATH_BARE)/build/make/gen_msvs_sln.sh \
|
||||
$(if $(filter %vpx.vcproj,$^),\
|
||||
$(foreach vcp,$(filter-out %vpx.vcproj %gtest.vcproj %obj_int_extract.vcproj,$^),\
|
||||
--dep=$(vcp:.vcproj=):vpx) \
|
||||
$(foreach vcp,$(filter %_test.vcproj,$^),\
|
||||
--dep=$(vcp:.vcproj=):gtest)) \
|
||||
--dep=vpx:obj_int_extract \
|
||||
--ver=$(CONFIG_VS_VERSION)\
|
||||
--out=$@ $^
|
||||
$(if $(filter vpx.vcproj,$^),$(VPX_RDEPS)) \
|
||||
--dep=vpx:obj_int_extract \
|
||||
--dep=test_libvpx:gtest \
|
||||
--ver=$(CONFIG_VS_VERSION)\
|
||||
--out=$@ $^
|
||||
vpx.sln.mk: vpx.sln
|
||||
@true
|
||||
|
||||
|
53
test/acm_random.h
Normal file
53
test/acm_random.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBVPX_TEST_ACM_RANDOM_H_
|
||||
#define LIBVPX_TEST_ACM_RANDOM_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
class ACMRandom {
|
||||
public:
|
||||
ACMRandom() {
|
||||
Reset(DeterministicSeed());
|
||||
}
|
||||
|
||||
explicit ACMRandom(int seed) {
|
||||
Reset(seed);
|
||||
}
|
||||
|
||||
void Reset(int seed) {
|
||||
srand(seed);
|
||||
}
|
||||
|
||||
uint8_t Rand8(void) {
|
||||
return (rand() >> 8) & 0xff;
|
||||
}
|
||||
|
||||
int PseudoUniform(int range) {
|
||||
return (rand() >> 8) % range;
|
||||
}
|
||||
|
||||
int operator()(int n) {
|
||||
return PseudoUniform(n);
|
||||
}
|
||||
|
||||
static int DeterministicSeed(void) {
|
||||
return 0xbaba;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // LIBVPX_TEST_ACM_RANDOM_H_
|
71
test/altref_test.cc
Normal file
71
test/altref_test.cc
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// lookahead range: [kLookAheadMin, kLookAheadMax).
|
||||
const int kLookAheadMin = 5;
|
||||
const int kLookAheadMax = 26;
|
||||
|
||||
class AltRefTest : public libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<int> {
|
||||
protected:
|
||||
AltRefTest() : altref_count_(0) {}
|
||||
virtual ~AltRefTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int pass) {
|
||||
altref_count_ = 0;
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
|
||||
encoder->Control(VP8E_SET_CPUUSED, 3);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) ++altref_count_;
|
||||
}
|
||||
|
||||
int altref_count() const { return altref_count_; }
|
||||
|
||||
private:
|
||||
int altref_count_;
|
||||
};
|
||||
|
||||
TEST_P(AltRefTest, MonotonicTimestamps) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = 1000;
|
||||
cfg_.g_lag_in_frames = GetParam();
|
||||
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
EXPECT_GE(altref_count(), 1);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(NonZeroLag, AltRefTest,
|
||||
::testing::Range(kLookAheadMin, kLookAheadMax));
|
||||
} // namespace
|
90
test/boolcoder_test.cc
Normal file
90
test/boolcoder_test.cc
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include "vp8/encoder/boolhuff.h"
|
||||
#include "vp8/decoder/dboolhuff.h"
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
namespace {
|
||||
const int num_tests = 10;
|
||||
} // namespace
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
TEST(VP8, TestBitIO) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int n = 0; n < num_tests; ++n) {
|
||||
for (int method = 0; method <= 7; ++method) { // we generate various proba
|
||||
const int bits_to_test = 1000;
|
||||
uint8_t probas[bits_to_test];
|
||||
|
||||
for (int i = 0; i < bits_to_test; ++i) {
|
||||
const int parity = i & 1;
|
||||
probas[i] =
|
||||
(method == 0) ? 0 : (method == 1) ? 255 :
|
||||
(method == 2) ? 128 :
|
||||
(method == 3) ? rnd.Rand8() :
|
||||
(method == 4) ? (parity ? 0 : 255) :
|
||||
// alternate between low and high proba:
|
||||
(method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) :
|
||||
(method == 6) ?
|
||||
(parity ? rnd(64) : 255 - rnd(64)) :
|
||||
(parity ? rnd(32) : 255 - rnd(32));
|
||||
}
|
||||
for (int bit_method = 0; bit_method <= 3; ++bit_method) {
|
||||
const int random_seed = 6432;
|
||||
const int buffer_size = 10000;
|
||||
ACMRandom bit_rnd(random_seed);
|
||||
BOOL_CODER bw;
|
||||
uint8_t bw_buffer[buffer_size];
|
||||
vp8_start_encode(&bw, bw_buffer, bw_buffer + buffer_size);
|
||||
|
||||
int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
|
||||
for (int i = 0; i < bits_to_test; ++i) {
|
||||
if (bit_method == 2) {
|
||||
bit = (i & 1);
|
||||
} else if (bit_method == 3) {
|
||||
bit = bit_rnd(2);
|
||||
}
|
||||
vp8_encode_bool(&bw, bit, static_cast<int>(probas[i]));
|
||||
}
|
||||
|
||||
vp8_stop_encode(&bw);
|
||||
|
||||
BOOL_DECODER br;
|
||||
vp8dx_start_decode(&br, bw_buffer, buffer_size);
|
||||
bit_rnd.Reset(random_seed);
|
||||
for (int i = 0; i < bits_to_test; ++i) {
|
||||
if (bit_method == 2) {
|
||||
bit = (i & 1);
|
||||
} else if (bit_method == 3) {
|
||||
bit = bit_rnd(2);
|
||||
}
|
||||
GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
|
||||
<< "pos: "<< i << " / " << bits_to_test
|
||||
<< " bit_method: " << bit_method
|
||||
<< " method: " << method;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
61
test/config_test.cc
Normal file
61
test/config_test.cc
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ConfigTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
public:
|
||||
ConfigTest() : frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}
|
||||
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
frame_count_in_ = 0;
|
||||
frame_count_out_ = 0;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {
|
||||
++frame_count_in_;
|
||||
abort_ |= (frame_count_in_ >= frame_count_max_);
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {
|
||||
++frame_count_out_;
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
unsigned int frame_count_in_;
|
||||
unsigned int frame_count_out_;
|
||||
unsigned int frame_count_max_;
|
||||
};
|
||||
|
||||
TEST_P(ConfigTest, LagIsDisabled) {
|
||||
frame_count_max_ = 2;
|
||||
cfg_.g_lag_in_frames = 15;
|
||||
|
||||
libvpx_test::DummyVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
EXPECT_EQ(frame_count_in_, frame_count_out_);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OnePassModes, ConfigTest, ONE_PASS_TEST_MODES);
|
||||
} // namespace
|
106
test/cq_test.cc
Normal file
106
test/cq_test.cc
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <cmath>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
|
||||
// CQ level range: [kCQLevelMin, kCQLevelMax).
|
||||
const int kCQLevelMin = 4;
|
||||
const int kCQLevelMax = 63;
|
||||
const int kCQLevelStep = 8;
|
||||
const int kCQTargetBitrate = 2000;
|
||||
|
||||
namespace {
|
||||
|
||||
class CQTest : public libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<int> {
|
||||
protected:
|
||||
CQTest() : cq_level_(GetParam()) { init_flags_ = VPX_CODEC_USE_PSNR; }
|
||||
virtual ~CQTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(libvpx_test::kTwoPassGood);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
file_size_ = 0;
|
||||
psnr_ = 0.0;
|
||||
n_frames_ = 0;
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
|
||||
libvpx_test::Encoder *encoder) {
|
||||
if (video->frame() == 1) {
|
||||
if (cfg_.rc_end_usage == VPX_CQ) {
|
||||
encoder->Control(VP8E_SET_CQ_LEVEL, cq_level_);
|
||||
}
|
||||
encoder->Control(VP8E_SET_CPUUSED, 3);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
psnr_ += pow(10.0, pkt->data.psnr.psnr[0] / 10.0);
|
||||
n_frames_++;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
file_size_ += pkt->data.frame.sz;
|
||||
}
|
||||
|
||||
double GetLinearPSNROverBitrate() const {
|
||||
double avg_psnr = log10(psnr_ / n_frames_) * 10.0;
|
||||
return pow(10.0, avg_psnr / 10.0) / file_size_;
|
||||
}
|
||||
|
||||
int file_size() const { return file_size_; }
|
||||
int n_frames() const { return n_frames_; }
|
||||
|
||||
private:
|
||||
int cq_level_;
|
||||
int file_size_;
|
||||
double psnr_;
|
||||
int n_frames_;
|
||||
};
|
||||
|
||||
int prev_actual_bitrate = kCQTargetBitrate;
|
||||
TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = kCQTargetBitrate;
|
||||
cfg_.g_lag_in_frames = 25;
|
||||
|
||||
cfg_.rc_end_usage = VPX_CQ;
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
const double cq_psnr_lin = GetLinearPSNROverBitrate();
|
||||
const int cq_actual_bitrate = file_size() * 8 * 30 / (n_frames() * 1000);
|
||||
EXPECT_LE(cq_actual_bitrate, kCQTargetBitrate);
|
||||
EXPECT_LE(cq_actual_bitrate, prev_actual_bitrate);
|
||||
prev_actual_bitrate = cq_actual_bitrate;
|
||||
|
||||
// try targeting the approximate same bitrate with VBR mode
|
||||
cfg_.rc_end_usage = VPX_VBR;
|
||||
cfg_.rc_target_bitrate = cq_actual_bitrate;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
const double vbr_psnr_lin = GetLinearPSNROverBitrate();
|
||||
EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CQLevelRange, CQTest,
|
||||
::testing::Range(kCQLevelMin, kCQLevelMax,
|
||||
kCQLevelStep));
|
||||
} // namespace
|
178
test/datarate_test.cc
Normal file
178
test/datarate_test.cc
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
namespace {
|
||||
|
||||
class DatarateTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
ResetModel();
|
||||
}
|
||||
|
||||
virtual void ResetModel() {
|
||||
last_pts_ = 0;
|
||||
bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz;
|
||||
frame_number_ = 0;
|
||||
first_drop_ = 0;
|
||||
bits_total_ = 0;
|
||||
duration_ = 0.0;
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
const vpx_rational_t tb = video->timebase();
|
||||
timebase_ = static_cast<double>(tb.num) / tb.den;
|
||||
duration_ = 0;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
// Time since last timestamp = duration.
|
||||
vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
|
||||
|
||||
// TODO(jimbankoski): Remove these lines when the issue:
|
||||
// http://code.google.com/p/webm/issues/detail?id=496 is fixed.
|
||||
// For now the codec assumes buffer starts at starting buffer rate
|
||||
// plus one frame's time.
|
||||
if (last_pts_ == 0)
|
||||
duration = 1;
|
||||
|
||||
// Add to the buffer the bits we'd expect from a constant bitrate server.
|
||||
bits_in_buffer_model_ += duration * timebase_ * cfg_.rc_target_bitrate
|
||||
* 1000;
|
||||
|
||||
/* Test the buffer model here before subtracting the frame. Do so because
|
||||
* the way the leaky bucket model works in libvpx is to allow the buffer to
|
||||
* empty - and then stop showing frames until we've got enough bits to
|
||||
* show one. As noted in comment below (issue 495), this does not currently
|
||||
* apply to key frames. For now exclude key frames in condition below. */
|
||||
bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true: false;
|
||||
if (!key_frame) {
|
||||
ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
|
||||
<< pkt->data.frame.pts;
|
||||
}
|
||||
|
||||
const int frame_size_in_bits = pkt->data.frame.sz * 8;
|
||||
|
||||
// Subtract from the buffer the bits associated with a played back frame.
|
||||
bits_in_buffer_model_ -= frame_size_in_bits;
|
||||
|
||||
// Update the running total of bits for end of test datarate checks.
|
||||
bits_total_ += frame_size_in_bits ;
|
||||
|
||||
// If first drop not set and we have a drop set it to this time.
|
||||
if (!first_drop_ && duration > 1)
|
||||
first_drop_ = last_pts_ + 1;
|
||||
|
||||
// Update the most recent pts.
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
|
||||
// We update this so that we can calculate the datarate minus the last
|
||||
// frame encoded in the file.
|
||||
bits_in_last_frame_ = frame_size_in_bits;
|
||||
|
||||
++frame_number_;
|
||||
}
|
||||
|
||||
virtual void EndPassHook(void) {
|
||||
if (bits_total_) {
|
||||
const double file_size_in_kb = bits_total_ / 1000; /* bits per kilobit */
|
||||
|
||||
duration_ = (last_pts_ + 1) * timebase_;
|
||||
|
||||
// Effective file datarate includes the time spent prebuffering.
|
||||
effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0
|
||||
/ (cfg_.rc_buf_initial_sz / 1000.0 + duration_);
|
||||
|
||||
file_datarate_ = file_size_in_kb / duration_;
|
||||
}
|
||||
}
|
||||
|
||||
vpx_codec_pts_t last_pts_;
|
||||
int bits_in_buffer_model_;
|
||||
double timebase_;
|
||||
int frame_number_;
|
||||
vpx_codec_pts_t first_drop_;
|
||||
int64_t bits_total_;
|
||||
double duration_;
|
||||
double file_datarate_;
|
||||
double effective_datarate_;
|
||||
int bits_in_last_frame_;
|
||||
};
|
||||
|
||||
TEST_P(DatarateTest, BasicBufferModel) {
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_dropframe_thresh = 1;
|
||||
cfg_.rc_max_quantizer = 56;
|
||||
cfg_.rc_end_usage = VPX_CBR;
|
||||
// 2 pass cbr datarate control has a bug hidden by the small # of
|
||||
// frames selected in this encode. The problem is that even if the buffer is
|
||||
// negative we produce a keyframe on a cutscene. Ignoring datarate
|
||||
// constraints
|
||||
// TODO(jimbankoski): ( Fix when issue
|
||||
// http://code.google.com/p/webm/issues/detail?id=495 is addressed. )
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 140);
|
||||
|
||||
// There is an issue for low bitrates in real-time mode, where the
|
||||
// effective_datarate slightly overshoots the target bitrate.
|
||||
// This is same the issue as noted about (#495).
|
||||
// TODO(jimbankoski/marpan): Update test to run for lower bitrates (< 100),
|
||||
// when the issue is resolved.
|
||||
for (int i = 100; i < 800; i += 200) {
|
||||
cfg_.rc_target_bitrate = i;
|
||||
ResetModel();
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_)
|
||||
<< " The datarate for the file exceeds the target!";
|
||||
|
||||
ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3)
|
||||
<< " The datarate for the file missed the target!";
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(DatarateTest, ChangingDropFrameThresh) {
|
||||
cfg_.rc_buf_initial_sz = 500;
|
||||
cfg_.rc_max_quantizer = 36;
|
||||
cfg_.rc_end_usage = VPX_CBR;
|
||||
cfg_.rc_target_bitrate = 200;
|
||||
cfg_.kf_mode = VPX_KF_DISABLED;
|
||||
|
||||
const int frame_count = 40;
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, frame_count);
|
||||
|
||||
// Here we check that the first dropped frame gets earlier and earlier
|
||||
// as the drop frame threshold is increased.
|
||||
|
||||
const int kDropFrameThreshTestStep = 30;
|
||||
vpx_codec_pts_t last_drop = frame_count;
|
||||
for (int i = 1; i < 91; i += kDropFrameThreshTestStep) {
|
||||
cfg_.rc_dropframe_thresh = i;
|
||||
ResetModel();
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
ASSERT_LE(first_drop_, last_drop)
|
||||
<< " The first dropped frame for drop_thresh " << i
|
||||
<< " > first dropped frame for drop_thresh "
|
||||
<< i - kDropFrameThreshTestStep;
|
||||
last_drop = first_drop_;
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllModes, DatarateTest, ALL_TEST_MODES);
|
||||
} // namespace
|
48
test/decode_test_driver.cc
Normal file
48
test/decode_test_driver.cc
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "test/decode_test_driver.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
#if CONFIG_VP8_DECODER
|
||||
void Decoder::DecodeFrame(const uint8_t *cxdata, int size) {
|
||||
if (!decoder_.priv) {
|
||||
const vpx_codec_err_t res_init = vpx_codec_dec_init(&decoder_,
|
||||
&vpx_codec_vp8_dx_algo,
|
||||
&cfg_, 0);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res_init) << DecodeError();
|
||||
}
|
||||
|
||||
vpx_codec_err_t res_dec;
|
||||
REGISTER_STATE_CHECK(res_dec = vpx_codec_decode(&decoder_,
|
||||
cxdata, size, NULL, 0));
|
||||
ASSERT_EQ(VPX_CODEC_OK, res_dec) << DecodeError();
|
||||
}
|
||||
|
||||
void DecoderTest::RunLoop(CompressedVideoSource *video) {
|
||||
vpx_codec_dec_cfg_t dec_cfg = {0};
|
||||
Decoder decoder(dec_cfg, 0);
|
||||
|
||||
// Decode frames.
|
||||
for (video->Begin(); video->cxdata(); video->Next()) {
|
||||
decoder.DecodeFrame(video->cxdata(), video->frame_size());
|
||||
|
||||
DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img = NULL;
|
||||
|
||||
// Get decompressed data
|
||||
while ((img = dec_iter.Next()))
|
||||
DecompressedFrameHook(*img, video->frame_number());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // namespace libvpx_test
|
97
test/decode_test_driver.h
Normal file
97
test/decode_test_driver.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
#ifndef TEST_DECODE_TEST_DRIVER_H_
|
||||
#define TEST_DECODE_TEST_DRIVER_H_
|
||||
#include <cstring>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx_config.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vp8dx.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
class CompressedVideoSource;
|
||||
|
||||
// Provides an object to handle decoding output
|
||||
class DxDataIterator {
|
||||
public:
|
||||
explicit DxDataIterator(vpx_codec_ctx_t *decoder)
|
||||
: decoder_(decoder), iter_(NULL) {}
|
||||
|
||||
const vpx_image_t *Next() {
|
||||
return vpx_codec_get_frame(decoder_, &iter_);
|
||||
}
|
||||
|
||||
private:
|
||||
vpx_codec_ctx_t *decoder_;
|
||||
vpx_codec_iter_t iter_;
|
||||
};
|
||||
|
||||
// Provides a simplified interface to manage one video decoding.
|
||||
//
|
||||
// TODO: similar to Encoder class, the exact services should be
|
||||
// added as more tests are added.
|
||||
class Decoder {
|
||||
public:
|
||||
Decoder(vpx_codec_dec_cfg_t cfg, unsigned long deadline)
|
||||
: cfg_(cfg), deadline_(deadline) {
|
||||
memset(&decoder_, 0, sizeof(decoder_));
|
||||
}
|
||||
|
||||
~Decoder() {
|
||||
vpx_codec_destroy(&decoder_);
|
||||
}
|
||||
|
||||
void DecodeFrame(const uint8_t *cxdata, int size);
|
||||
|
||||
DxDataIterator GetDxData() {
|
||||
return DxDataIterator(&decoder_);
|
||||
}
|
||||
|
||||
void set_deadline(unsigned long deadline) {
|
||||
deadline_ = deadline;
|
||||
}
|
||||
|
||||
void Control(int ctrl_id, int arg) {
|
||||
const vpx_codec_err_t res = vpx_codec_control_(&decoder_, ctrl_id, arg);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
|
||||
}
|
||||
|
||||
protected:
|
||||
const char *DecodeError() {
|
||||
const char *detail = vpx_codec_error_detail(&decoder_);
|
||||
return detail ? detail : vpx_codec_error(&decoder_);
|
||||
}
|
||||
|
||||
vpx_codec_ctx_t decoder_;
|
||||
vpx_codec_dec_cfg_t cfg_;
|
||||
unsigned int deadline_;
|
||||
};
|
||||
|
||||
// Common test functionality for all Decoder tests.
|
||||
class DecoderTest {
|
||||
public:
|
||||
// Main loop.
|
||||
virtual void RunLoop(CompressedVideoSource *video);
|
||||
|
||||
// Hook to be called on every decompressed frame.
|
||||
virtual void DecompressedFrameHook(const vpx_image_t& img,
|
||||
const unsigned int frame_number) {}
|
||||
|
||||
protected:
|
||||
DecoderTest() {}
|
||||
|
||||
virtual ~DecoderTest() {}
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // TEST_DECODE_TEST_DRIVER_H_
|
206
test/encode_test_driver.cc
Normal file
206
test/encode_test_driver.cc
Normal file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "vpx_config.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#if CONFIG_VP8_DECODER
|
||||
#include "test/decode_test_driver.h"
|
||||
#endif
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/video_source.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) {
|
||||
if (video->img())
|
||||
EncodeFrameInternal(*video, frame_flags);
|
||||
else
|
||||
Flush();
|
||||
|
||||
// Handle twopass stats
|
||||
CxDataIterator iter = GetCxData();
|
||||
|
||||
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
if (pkt->kind != VPX_CODEC_STATS_PKT)
|
||||
continue;
|
||||
|
||||
stats_->Append(*pkt);
|
||||
}
|
||||
}
|
||||
|
||||
void Encoder::EncodeFrameInternal(const VideoSource &video,
|
||||
const unsigned long frame_flags) {
|
||||
vpx_codec_err_t res;
|
||||
const vpx_image_t *img = video.img();
|
||||
|
||||
// Handle first frame initialization
|
||||
if (!encoder_.priv) {
|
||||
cfg_.g_w = img->d_w;
|
||||
cfg_.g_h = img->d_h;
|
||||
cfg_.g_timebase = video.timebase();
|
||||
cfg_.rc_twopass_stats_in = stats_->buf();
|
||||
res = vpx_codec_enc_init(&encoder_, &vpx_codec_vp8_cx_algo, &cfg_,
|
||||
init_flags_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
// Handle frame resizing
|
||||
if (cfg_.g_w != img->d_w || cfg_.g_h != img->d_h) {
|
||||
cfg_.g_w = img->d_w;
|
||||
cfg_.g_h = img->d_h;
|
||||
res = vpx_codec_enc_config_set(&encoder_, &cfg_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
// Encode the frame
|
||||
REGISTER_STATE_CHECK(
|
||||
res = vpx_codec_encode(&encoder_,
|
||||
video.img(), video.pts(), video.duration(),
|
||||
frame_flags, deadline_));
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void Encoder::Flush() {
|
||||
const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0,
|
||||
deadline_);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void EncoderTest::SetMode(TestMode mode) {
|
||||
switch (mode) {
|
||||
case kRealTime:
|
||||
deadline_ = VPX_DL_REALTIME;
|
||||
break;
|
||||
|
||||
case kOnePassGood:
|
||||
case kTwoPassGood:
|
||||
deadline_ = VPX_DL_GOOD_QUALITY;
|
||||
break;
|
||||
|
||||
case kOnePassBest:
|
||||
case kTwoPassBest:
|
||||
deadline_ = VPX_DL_BEST_QUALITY;
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT_TRUE(false) << "Unexpected mode " << mode;
|
||||
}
|
||||
|
||||
if (mode == kTwoPassGood || mode == kTwoPassBest)
|
||||
passes_ = 2;
|
||||
else
|
||||
passes_ = 1;
|
||||
}
|
||||
// The function should return "true" most of the time, therefore no early
|
||||
// break-out is implemented within the match checking process.
|
||||
static bool compare_img(const vpx_image_t *img1,
|
||||
const vpx_image_t *img2) {
|
||||
bool match = (img1->fmt == img2->fmt) &&
|
||||
(img1->d_w == img2->d_w) &&
|
||||
(img1->d_h == img2->d_h);
|
||||
|
||||
const unsigned int width_y = img1->d_w;
|
||||
const unsigned int height_y = img1->d_h;
|
||||
unsigned int i;
|
||||
for (i = 0; i < height_y; ++i)
|
||||
match = ( memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
|
||||
img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
|
||||
width_y) == 0) && match;
|
||||
const unsigned int width_uv = (img1->d_w + 1) >> 1;
|
||||
const unsigned int height_uv = (img1->d_h + 1) >> 1;
|
||||
for (i = 0; i < height_uv; ++i)
|
||||
match = ( memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],
|
||||
img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],
|
||||
width_uv) == 0) && match;
|
||||
for (i = 0; i < height_uv; ++i)
|
||||
match = ( memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],
|
||||
img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],
|
||||
width_uv) == 0) && match;
|
||||
return match;
|
||||
}
|
||||
|
||||
void EncoderTest::RunLoop(VideoSource *video) {
|
||||
#if CONFIG_VP8_DECODER
|
||||
vpx_codec_dec_cfg_t dec_cfg = {0};
|
||||
#endif
|
||||
|
||||
stats_.Reset();
|
||||
|
||||
for (unsigned int pass = 0; pass < passes_; pass++) {
|
||||
last_pts_ = 0;
|
||||
|
||||
if (passes_ == 1)
|
||||
cfg_.g_pass = VPX_RC_ONE_PASS;
|
||||
else if (pass == 0)
|
||||
cfg_.g_pass = VPX_RC_FIRST_PASS;
|
||||
else
|
||||
cfg_.g_pass = VPX_RC_LAST_PASS;
|
||||
|
||||
BeginPassHook(pass);
|
||||
Encoder encoder(cfg_, deadline_, init_flags_, &stats_);
|
||||
#if CONFIG_VP8_DECODER
|
||||
Decoder decoder(dec_cfg, 0);
|
||||
bool has_cxdata = false;
|
||||
#endif
|
||||
bool again;
|
||||
for (again = true, video->Begin(); again; video->Next()) {
|
||||
again = video->img() != NULL;
|
||||
|
||||
PreEncodeFrameHook(video);
|
||||
PreEncodeFrameHook(video, &encoder);
|
||||
encoder.EncodeFrame(video, frame_flags_);
|
||||
|
||||
CxDataIterator iter = encoder.GetCxData();
|
||||
|
||||
while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
|
||||
again = true;
|
||||
|
||||
switch (pkt->kind) {
|
||||
case VPX_CODEC_CX_FRAME_PKT:
|
||||
#if CONFIG_VP8_DECODER
|
||||
has_cxdata = true;
|
||||
decoder.DecodeFrame((const uint8_t*)pkt->data.frame.buf,
|
||||
pkt->data.frame.sz);
|
||||
#endif
|
||||
ASSERT_GE(pkt->data.frame.pts, last_pts_);
|
||||
last_pts_ = pkt->data.frame.pts;
|
||||
FramePktHook(pkt);
|
||||
break;
|
||||
|
||||
case VPX_CODEC_PSNR_PKT:
|
||||
PSNRPktHook(pkt);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP8_DECODER
|
||||
if (has_cxdata) {
|
||||
const vpx_image_t *img_enc = encoder.GetPreviewFrame();
|
||||
DxDataIterator dec_iter = decoder.GetDxData();
|
||||
const vpx_image_t *img_dec = dec_iter.Next();
|
||||
if(img_enc && img_dec) {
|
||||
const bool res = compare_img(img_enc, img_dec);
|
||||
ASSERT_TRUE(res)<< "Encoder/Decoder mismatch found.";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!Continue())
|
||||
break;
|
||||
}
|
||||
|
||||
EndPassHook();
|
||||
|
||||
if (!Continue())
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // namespace libvpx_test
|
197
test/encode_test_driver.h
Normal file
197
test/encode_test_driver.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
#ifndef TEST_ENCODE_TEST_DRIVER_H_
|
||||
#define TEST_ENCODE_TEST_DRIVER_H_
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
#include "vpx/vp8cx.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
class VideoSource;
|
||||
|
||||
enum TestMode {
|
||||
kRealTime,
|
||||
kOnePassGood,
|
||||
kOnePassBest,
|
||||
kTwoPassGood,
|
||||
kTwoPassBest
|
||||
};
|
||||
#define ALL_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
|
||||
::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest, \
|
||||
::libvpx_test::kTwoPassGood, \
|
||||
::libvpx_test::kTwoPassBest)
|
||||
|
||||
#define ONE_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \
|
||||
::libvpx_test::kOnePassGood, \
|
||||
::libvpx_test::kOnePassBest)
|
||||
|
||||
|
||||
// Provides an object to handle the libvpx get_cx_data() iteration pattern
|
||||
class CxDataIterator {
|
||||
public:
|
||||
explicit CxDataIterator(vpx_codec_ctx_t *encoder)
|
||||
: encoder_(encoder), iter_(NULL) {}
|
||||
|
||||
const vpx_codec_cx_pkt_t *Next() {
|
||||
return vpx_codec_get_cx_data(encoder_, &iter_);
|
||||
}
|
||||
|
||||
private:
|
||||
vpx_codec_ctx_t *encoder_;
|
||||
vpx_codec_iter_t iter_;
|
||||
};
|
||||
|
||||
// Implements an in-memory store for libvpx twopass statistics
|
||||
class TwopassStatsStore {
|
||||
public:
|
||||
void Append(const vpx_codec_cx_pkt_t &pkt) {
|
||||
buffer_.append(reinterpret_cast<char *>(pkt.data.twopass_stats.buf),
|
||||
pkt.data.twopass_stats.sz);
|
||||
}
|
||||
|
||||
vpx_fixed_buf_t buf() {
|
||||
const vpx_fixed_buf_t buf = { &buffer_[0], buffer_.size() };
|
||||
return buf;
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
buffer_.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string buffer_;
|
||||
};
|
||||
|
||||
|
||||
// Provides a simplified interface to manage one video encoding pass, given
|
||||
// a configuration and video source.
|
||||
//
|
||||
// TODO(jkoleszar): The exact services it provides and the appropriate
|
||||
// level of abstraction will be fleshed out as more tests are written.
|
||||
class Encoder {
|
||||
public:
|
||||
Encoder(vpx_codec_enc_cfg_t cfg, unsigned long deadline,
|
||||
const unsigned long init_flags, TwopassStatsStore *stats)
|
||||
: cfg_(cfg), deadline_(deadline), init_flags_(init_flags), stats_(stats) {
|
||||
memset(&encoder_, 0, sizeof(encoder_));
|
||||
}
|
||||
|
||||
~Encoder() {
|
||||
vpx_codec_destroy(&encoder_);
|
||||
}
|
||||
|
||||
CxDataIterator GetCxData() {
|
||||
return CxDataIterator(&encoder_);
|
||||
}
|
||||
|
||||
const vpx_image_t *GetPreviewFrame() {
|
||||
return vpx_codec_get_preview_frame(&encoder_);
|
||||
}
|
||||
// This is a thin wrapper around vpx_codec_encode(), so refer to
|
||||
// vpx_encoder.h for its semantics.
|
||||
void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
|
||||
|
||||
// Convenience wrapper for EncodeFrame()
|
||||
void EncodeFrame(VideoSource *video) {
|
||||
EncodeFrame(video, 0);
|
||||
}
|
||||
|
||||
void Control(int ctrl_id, int arg) {
|
||||
const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
|
||||
}
|
||||
|
||||
void set_deadline(unsigned long deadline) {
|
||||
deadline_ = deadline;
|
||||
}
|
||||
|
||||
protected:
|
||||
const char *EncoderError() {
|
||||
const char *detail = vpx_codec_error_detail(&encoder_);
|
||||
return detail ? detail : vpx_codec_error(&encoder_);
|
||||
}
|
||||
|
||||
// Encode an image
|
||||
void EncodeFrameInternal(const VideoSource &video,
|
||||
const unsigned long frame_flags);
|
||||
|
||||
// Flush the encoder on EOS
|
||||
void Flush();
|
||||
|
||||
vpx_codec_ctx_t encoder_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
unsigned long deadline_;
|
||||
unsigned long init_flags_;
|
||||
TwopassStatsStore *stats_;
|
||||
};
|
||||
|
||||
// Common test functionality for all Encoder tests.
|
||||
//
|
||||
// This class is a mixin which provides the main loop common to all
|
||||
// encoder tests. It provides hooks which can be overridden by subclasses
|
||||
// to implement each test's specific behavior, while centralizing the bulk
|
||||
// of the boilerplate. Note that it doesn't inherit the gtest testing
|
||||
// classes directly, so that tests can be parameterized differently.
|
||||
class EncoderTest {
|
||||
protected:
|
||||
EncoderTest() : abort_(false), init_flags_(0), frame_flags_(0),
|
||||
last_pts_(0) {}
|
||||
|
||||
virtual ~EncoderTest() {}
|
||||
|
||||
// Initialize the cfg_ member with the default configuration.
|
||||
void InitializeConfig() {
|
||||
const vpx_codec_err_t res = vpx_codec_enc_config_default(
|
||||
&vpx_codec_vp8_cx_algo, &cfg_, 0);
|
||||
ASSERT_EQ(VPX_CODEC_OK, res);
|
||||
}
|
||||
|
||||
// Map the TestMode enum to the deadline_ and passes_ variables.
|
||||
void SetMode(TestMode mode);
|
||||
|
||||
// Main loop.
|
||||
virtual void RunLoop(VideoSource *video);
|
||||
|
||||
// Hook to be called at the beginning of a pass.
|
||||
virtual void BeginPassHook(unsigned int pass) {}
|
||||
|
||||
// Hook to be called at the end of a pass.
|
||||
virtual void EndPassHook() {}
|
||||
|
||||
// Hook to be called before encoding a frame.
|
||||
virtual void PreEncodeFrameHook(VideoSource *video) {}
|
||||
virtual void PreEncodeFrameHook(VideoSource *video, Encoder *encoder) {}
|
||||
|
||||
// Hook to be called on every compressed data packet.
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {}
|
||||
|
||||
// Hook to be called on every PSNR packet.
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {}
|
||||
|
||||
// Hook to determine whether the encode loop should continue.
|
||||
virtual bool Continue() const { return !abort_; }
|
||||
|
||||
bool abort_;
|
||||
vpx_codec_enc_cfg_t cfg_;
|
||||
unsigned int passes_;
|
||||
unsigned long deadline_;
|
||||
TwopassStatsStore stats_;
|
||||
unsigned long init_flags_;
|
||||
unsigned long frame_flags_;
|
||||
vpx_codec_pts_t last_pts_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // TEST_ENCODE_TEST_DRIVER_H_
|
90
test/error_resilience_test.cc
Normal file
90
test/error_resilience_test.cc
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
Copyright (c) 2012 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 "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ErrorResilienceTest : public libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<int> {
|
||||
protected:
|
||||
ErrorResilienceTest() {
|
||||
psnr_ = 0.0;
|
||||
nframes_ = 0;
|
||||
encoding_mode_ = static_cast<libvpx_test::TestMode>(GetParam());
|
||||
}
|
||||
virtual ~ErrorResilienceTest() {}
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(encoding_mode_);
|
||||
}
|
||||
|
||||
virtual void BeginPassHook(unsigned int /*pass*/) {
|
||||
psnr_ = 0.0;
|
||||
nframes_ = 0;
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
psnr_ += pkt->data.psnr.psnr[0];
|
||||
nframes_++;
|
||||
}
|
||||
|
||||
double GetAveragePsnr() const {
|
||||
if (nframes_)
|
||||
return psnr_ / nframes_;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
private:
|
||||
double psnr_;
|
||||
unsigned int nframes_;
|
||||
libvpx_test::TestMode encoding_mode_;
|
||||
};
|
||||
|
||||
TEST_P(ErrorResilienceTest, OnVersusOff) {
|
||||
const vpx_rational timebase = { 33333333, 1000000000 };
|
||||
cfg_.g_timebase = timebase;
|
||||
cfg_.rc_target_bitrate = 2000;
|
||||
cfg_.g_lag_in_frames = 25;
|
||||
|
||||
init_flags_ = VPX_CODEC_USE_PSNR;
|
||||
|
||||
libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
timebase.den, timebase.num, 0, 30);
|
||||
|
||||
// Error resilient mode OFF.
|
||||
cfg_.g_error_resilient = 0;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
const double psnr_resilience_off = GetAveragePsnr();
|
||||
EXPECT_GT(psnr_resilience_off, 25.0);
|
||||
|
||||
// Error resilient mode ON.
|
||||
cfg_.g_error_resilient = 1;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
const double psnr_resilience_on = GetAveragePsnr();
|
||||
EXPECT_GT(psnr_resilience_on, 25.0);
|
||||
|
||||
// Test that turning on error resilient mode hurts by 10% at most.
|
||||
if (psnr_resilience_off > 0.0) {
|
||||
const double psnr_ratio = psnr_resilience_on / psnr_resilience_off;
|
||||
EXPECT_GE(psnr_ratio, 0.9);
|
||||
EXPECT_LE(psnr_ratio, 1.1);
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OnOffTest, ErrorResilienceTest,
|
||||
ONE_PASS_TEST_MODES);
|
||||
} // namespace
|
169
test/fdct4x4_test.cc
Normal file
169
test/fdct4x4_test.cc
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include "vpx_rtcd.h"
|
||||
}
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
const int cospi8sqrt2minus1 = 20091;
|
||||
const int sinpi8sqrt2 = 35468;
|
||||
|
||||
void reference_idct4x4(const int16_t *input, int16_t *output) {
|
||||
const int16_t *ip = input;
|
||||
int16_t *op = output;
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const int a1 = ip[0] + ip[8];
|
||||
const int b1 = ip[0] - ip[8];
|
||||
const int temp1 = (ip[4] * sinpi8sqrt2) >> 16;
|
||||
const int temp2 = ip[12] + ((ip[12] * cospi8sqrt2minus1) >> 16);
|
||||
const int c1 = temp1 - temp2;
|
||||
const int temp3 = ip[4] + ((ip[4] * cospi8sqrt2minus1) >> 16);
|
||||
const int temp4 = (ip[12] * sinpi8sqrt2) >> 16;
|
||||
const int d1 = temp3 + temp4;
|
||||
op[0] = a1 + d1;
|
||||
op[12] = a1 - d1;
|
||||
op[4] = b1 + c1;
|
||||
op[8] = b1 - c1;
|
||||
++ip;
|
||||
++op;
|
||||
}
|
||||
ip = output;
|
||||
op = output;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const int a1 = ip[0] + ip[2];
|
||||
const int b1 = ip[0] - ip[2];
|
||||
const int temp1 = (ip[1] * sinpi8sqrt2) >> 16;
|
||||
const int temp2 = ip[3] + ((ip[3] * cospi8sqrt2minus1) >> 16);
|
||||
const int c1 = temp1 - temp2;
|
||||
const int temp3 = ip[1] + ((ip[1] * cospi8sqrt2minus1) >> 16);
|
||||
const int temp4 = (ip[3] * sinpi8sqrt2) >> 16;
|
||||
const int d1 = temp3 + temp4;
|
||||
op[0] = (a1 + d1 + 4) >> 3;
|
||||
op[3] = (a1 - d1 + 4) >> 3;
|
||||
op[1] = (b1 + c1 + 4) >> 3;
|
||||
op[2] = (b1 - c1 + 4) >> 3;
|
||||
ip += 4;
|
||||
op += 4;
|
||||
}
|
||||
}
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
TEST(Vp8FdctTest, SignBiasCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int16_t test_input_block[16];
|
||||
int16_t test_output_block[16];
|
||||
const int pitch = 8;
|
||||
int count_sign_block[16][2];
|
||||
const int count_test_block = 1000000;
|
||||
|
||||
memset(count_sign_block, 0, sizeof(count_sign_block));
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
// Initialize a test block with input range [-255, 255].
|
||||
for (int j = 0; j < 16; ++j)
|
||||
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
|
||||
|
||||
vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
|
||||
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
if (test_output_block[j] < 0)
|
||||
++count_sign_block[j][0];
|
||||
else if (test_output_block[j] > 0)
|
||||
++count_sign_block[j][1];
|
||||
}
|
||||
}
|
||||
|
||||
bool bias_acceptable = true;
|
||||
for (int j = 0; j < 16; ++j)
|
||||
bias_acceptable = bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
|
||||
|
||||
EXPECT_EQ(true, bias_acceptable)
|
||||
<< "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";
|
||||
|
||||
memset(count_sign_block, 0, sizeof(count_sign_block));
|
||||
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
// Initialize a test block with input range [-15, 15].
|
||||
for (int j = 0; j < 16; ++j)
|
||||
test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4);
|
||||
|
||||
vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
|
||||
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
if (test_output_block[j] < 0)
|
||||
++count_sign_block[j][0];
|
||||
else if (test_output_block[j] > 0)
|
||||
++count_sign_block[j][1];
|
||||
}
|
||||
}
|
||||
|
||||
bias_acceptable = true;
|
||||
for (int j = 0; j < 16; ++j)
|
||||
bias_acceptable = bias_acceptable &&
|
||||
(abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
|
||||
|
||||
EXPECT_EQ(true, bias_acceptable)
|
||||
<< "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";
|
||||
};
|
||||
|
||||
TEST(Vp8FdctTest, RoundTripErrorCheck) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
int max_error = 0;
|
||||
double total_error = 0;
|
||||
const int count_test_block = 1000000;
|
||||
for (int i = 0; i < count_test_block; ++i) {
|
||||
int16_t test_input_block[16];
|
||||
int16_t test_temp_block[16];
|
||||
int16_t test_output_block[16];
|
||||
|
||||
// Initialize a test block with input range [-255, 255].
|
||||
for (int j = 0; j < 16; ++j)
|
||||
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
|
||||
|
||||
const int pitch = 8;
|
||||
vp8_short_fdct4x4_c(test_input_block, test_temp_block, pitch);
|
||||
reference_idct4x4(test_temp_block, test_output_block);
|
||||
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
const int diff = test_input_block[j] - test_output_block[j];
|
||||
const int error = diff * diff;
|
||||
if (max_error < error)
|
||||
max_error = error;
|
||||
total_error += error;
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_GE(1, max_error )
|
||||
<< "Error: FDCT/IDCT has an individual roundtrip error > 1";
|
||||
|
||||
EXPECT_GE(count_test_block, total_error)
|
||||
<< "Error: FDCT/IDCT has average roundtrip error > 1 per block";
|
||||
};
|
||||
|
||||
} // namespace
|
117
test/i420_video_source.h
Normal file
117
test/i420_video_source.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
#ifndef TEST_I420_VIDEO_SOURCE_H_
|
||||
#define TEST_I420_VIDEO_SOURCE_H_
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
// This class extends VideoSource to allow parsing of raw yv12
|
||||
// so that we can do actual file encodes.
|
||||
class I420VideoSource : public VideoSource {
|
||||
public:
|
||||
I420VideoSource(const std::string &file_name,
|
||||
unsigned int width, unsigned int height,
|
||||
int rate_numerator, int rate_denominator,
|
||||
unsigned int start, int limit)
|
||||
: file_name_(file_name),
|
||||
input_file_(NULL),
|
||||
img_(NULL),
|
||||
start_(start),
|
||||
limit_(limit),
|
||||
frame_(0),
|
||||
width_(0),
|
||||
height_(0),
|
||||
framerate_numerator_(rate_numerator),
|
||||
framerate_denominator_(rate_denominator) {
|
||||
|
||||
// This initializes raw_sz_, width_, height_ and allocates an img.
|
||||
SetSize(width, height);
|
||||
}
|
||||
|
||||
virtual ~I420VideoSource() {
|
||||
vpx_img_free(img_);
|
||||
if (input_file_)
|
||||
fclose(input_file_);
|
||||
}
|
||||
|
||||
virtual void Begin() {
|
||||
if (input_file_)
|
||||
fclose(input_file_);
|
||||
input_file_ = OpenTestDataFile(file_name_);
|
||||
ASSERT_TRUE(input_file_) << "Input file open failed. Filename: "
|
||||
<< file_name_;
|
||||
if (start_) {
|
||||
fseek(input_file_, raw_sz_ * start_, SEEK_SET);
|
||||
}
|
||||
|
||||
frame_ = start_;
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual void Next() {
|
||||
++frame_;
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
|
||||
|
||||
// Models a stream where Timebase = 1/FPS, so pts == frame.
|
||||
virtual vpx_codec_pts_t pts() const { return frame_; }
|
||||
|
||||
virtual unsigned long duration() const { return 1; }
|
||||
|
||||
virtual vpx_rational_t timebase() const {
|
||||
const vpx_rational_t t = { framerate_denominator_, framerate_numerator_ };
|
||||
return t;
|
||||
}
|
||||
|
||||
virtual unsigned int frame() const { return frame_; }
|
||||
|
||||
virtual unsigned int limit() const { return limit_; }
|
||||
|
||||
void SetSize(unsigned int width, unsigned int height) {
|
||||
if (width != width_ || height != height_) {
|
||||
vpx_img_free(img_);
|
||||
img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_VPXI420, width, height, 1);
|
||||
ASSERT_TRUE(img_ != NULL);
|
||||
width_ = width;
|
||||
height_ = height;
|
||||
raw_sz_ = width * height * 3 / 2;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void FillFrame() {
|
||||
// Read a frame from input_file.
|
||||
if (fread(img_->img_data, raw_sz_, 1, input_file_) == 0) {
|
||||
limit_ = frame_;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string file_name_;
|
||||
FILE *input_file_;
|
||||
vpx_image_t *img_;
|
||||
size_t raw_sz_;
|
||||
unsigned int start_;
|
||||
unsigned int limit_;
|
||||
unsigned int frame_;
|
||||
unsigned int width_;
|
||||
unsigned int height_;
|
||||
unsigned int framerate_numerator_;
|
||||
unsigned int framerate_denominator_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // TEST_I420_VIDEO_SOURCE_H_
|
126
test/idctllm_test.cc
Normal file
126
test/idctllm_test.cc
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
}
|
||||
#include "test/register_state_check.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,
|
||||
int pred_stride, unsigned char *dst_ptr,
|
||||
int dst_stride);
|
||||
namespace {
|
||||
class IDCTTest : public ::testing::TestWithParam<idct_fn_t>
|
||||
{
|
||||
protected:
|
||||
virtual void SetUp()
|
||||
{
|
||||
int i;
|
||||
|
||||
UUT = GetParam();
|
||||
memset(input, 0, sizeof(input));
|
||||
/* Set up guard blocks */
|
||||
for(i=0; i<256; i++)
|
||||
output[i] = ((i&0xF)<4&&(i<64))?0:-1;
|
||||
}
|
||||
|
||||
idct_fn_t UUT;
|
||||
short input[16];
|
||||
unsigned char output[256];
|
||||
unsigned char predict[256];
|
||||
};
|
||||
|
||||
TEST_P(IDCTTest, TestGuardBlocks)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
EXPECT_EQ(0, output[i]) << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]);
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAllZeros)
|
||||
{
|
||||
int i;
|
||||
|
||||
REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
EXPECT_EQ(0, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAllOnes)
|
||||
{
|
||||
int i;
|
||||
|
||||
input[0] = 4;
|
||||
REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
EXPECT_EQ(1, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestAddOne)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
predict[i] = i;
|
||||
|
||||
input[0] = 4;
|
||||
REGISTER_STATE_CHECK(UUT(input, predict, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) < 4 && i<64)
|
||||
EXPECT_EQ(i+1, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
}
|
||||
|
||||
TEST_P(IDCTTest, TestWithData)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<16; i++)
|
||||
input[i] = i;
|
||||
|
||||
REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
if((i&0xF) > 3 || i>63)
|
||||
EXPECT_EQ(255, output[i]) << "i==" << i;
|
||||
else if(i == 0)
|
||||
EXPECT_EQ(11, output[i]) << "i==" << i;
|
||||
else if(i == 34)
|
||||
EXPECT_EQ(1, output[i]) << "i==" << i;
|
||||
else if(i == 2 || i == 17 || i == 32)
|
||||
EXPECT_EQ(3, output[i]) << "i==" << i;
|
||||
else
|
||||
EXPECT_EQ(0, output[i]) << "i==" << i;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, IDCTTest,
|
||||
::testing::Values(vp8_short_idct4x4llm_c));
|
||||
#if HAVE_MMX
|
||||
INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
|
||||
::testing::Values(vp8_short_idct4x4llm_mmx));
|
||||
#endif
|
||||
}
|
357
test/intrapred_test.cc
Normal file
357
test/intrapred_test.cc
Normal file
@@ -0,0 +1,357 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <string.h>
|
||||
#include "test/acm_random.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
extern "C" {
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
class IntraPredBase {
|
||||
protected:
|
||||
void SetupMacroblock(uint8_t *data, int block_size, int stride,
|
||||
int num_planes) {
|
||||
memset(&mb_, 0, sizeof(mb_));
|
||||
memset(&mi_, 0, sizeof(mi_));
|
||||
mb_.up_available = 1;
|
||||
mb_.left_available = 1;
|
||||
mb_.mode_info_context = &mi_;
|
||||
stride_ = stride;
|
||||
block_size_ = block_size;
|
||||
num_planes_ = num_planes;
|
||||
for (int p = 0; p < num_planes; p++)
|
||||
data_ptr_[p] = data + stride * (block_size + 1) * p +
|
||||
stride + block_size;
|
||||
}
|
||||
|
||||
void FillRandom() {
|
||||
// Fill edges with random data
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int p = 0; p < num_planes_; p++) {
|
||||
for (int x = -1 ; x <= block_size_; x++)
|
||||
data_ptr_[p][x - stride_] = rnd.Rand8();
|
||||
for (int y = 0; y < block_size_; y++)
|
||||
data_ptr_[p][y * stride_ - 1] = rnd.Rand8();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Predict(MB_PREDICTION_MODE mode) = 0;
|
||||
|
||||
void SetLeftUnavailable() {
|
||||
mb_.left_available = 0;
|
||||
for (int p = 0; p < num_planes_; p++)
|
||||
for (int i = -1; i < block_size_; ++i)
|
||||
data_ptr_[p][stride_ * i - 1] = 129;
|
||||
}
|
||||
|
||||
void SetTopUnavailable() {
|
||||
mb_.up_available = 0;
|
||||
for (int p = 0; p < num_planes_; p++)
|
||||
memset(&data_ptr_[p][-1 - stride_], 127, block_size_ + 2);
|
||||
}
|
||||
|
||||
void SetTopLeftUnavailable() {
|
||||
SetLeftUnavailable();
|
||||
SetTopUnavailable();
|
||||
}
|
||||
|
||||
int BlockSizeLog2Min1() const {
|
||||
switch (block_size_) {
|
||||
case 16:
|
||||
return 3;
|
||||
case 8:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// check DC prediction output against a reference
|
||||
void CheckDCPrediction() const {
|
||||
for (int p = 0; p < num_planes_; p++) {
|
||||
// calculate expected DC
|
||||
int expected;
|
||||
if (mb_.up_available || mb_.left_available) {
|
||||
int sum = 0, shift = BlockSizeLog2Min1() + mb_.up_available +
|
||||
mb_.left_available;
|
||||
if (mb_.up_available)
|
||||
for (int x = 0; x < block_size_; x++)
|
||||
sum += data_ptr_[p][x - stride_];
|
||||
if (mb_.left_available)
|
||||
for (int y = 0; y < block_size_; y++)
|
||||
sum += data_ptr_[p][y * stride_ - 1];
|
||||
expected = (sum + (1 << (shift - 1))) >> shift;
|
||||
} else
|
||||
expected = 0x80;
|
||||
|
||||
// check that all subsequent lines are equal to the first
|
||||
for (int y = 1; y < block_size_; ++y)
|
||||
ASSERT_EQ(0, memcmp(data_ptr_[p], &data_ptr_[p][y * stride_],
|
||||
block_size_));
|
||||
// within the first line, ensure that each pixel has the same value
|
||||
for (int x = 1; x < block_size_; ++x)
|
||||
ASSERT_EQ(data_ptr_[p][0], data_ptr_[p][x]);
|
||||
// now ensure that that pixel has the expected (DC) value
|
||||
ASSERT_EQ(expected, data_ptr_[p][0]);
|
||||
}
|
||||
}
|
||||
|
||||
// check V prediction output against a reference
|
||||
void CheckVPrediction() const {
|
||||
// check that all lines equal the top border
|
||||
for (int p = 0; p < num_planes_; p++)
|
||||
for (int y = 0; y < block_size_; y++)
|
||||
ASSERT_EQ(0, memcmp(&data_ptr_[p][-stride_],
|
||||
&data_ptr_[p][y * stride_], block_size_));
|
||||
}
|
||||
|
||||
// check H prediction output against a reference
|
||||
void CheckHPrediction() const {
|
||||
// for each line, ensure that each pixel is equal to the left border
|
||||
for (int p = 0; p < num_planes_; p++)
|
||||
for (int y = 0; y < block_size_; y++)
|
||||
for (int x = 0; x < block_size_; x++)
|
||||
ASSERT_EQ(data_ptr_[p][-1 + y * stride_],
|
||||
data_ptr_[p][x + y * stride_]);
|
||||
}
|
||||
|
||||
static int ClipByte(int value) {
|
||||
if (value > 255)
|
||||
return 255;
|
||||
else if (value < 0)
|
||||
return 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
// check TM prediction output against a reference
|
||||
void CheckTMPrediction() const {
|
||||
for (int p = 0; p < num_planes_; p++)
|
||||
for (int y = 0; y < block_size_; y++)
|
||||
for (int x = 0; x < block_size_; x++) {
|
||||
const int expected = ClipByte(data_ptr_[p][x - stride_]
|
||||
+ data_ptr_[p][stride_ * y - 1]
|
||||
- data_ptr_[p][-1 - stride_]);
|
||||
ASSERT_EQ(expected, data_ptr_[p][y * stride_ + x]);
|
||||
}
|
||||
}
|
||||
|
||||
// Actual test
|
||||
void RunTest() {
|
||||
{
|
||||
SCOPED_TRACE("DC_PRED");
|
||||
FillRandom();
|
||||
Predict(DC_PRED);
|
||||
CheckDCPrediction();
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("DC_PRED LEFT");
|
||||
FillRandom();
|
||||
SetLeftUnavailable();
|
||||
Predict(DC_PRED);
|
||||
CheckDCPrediction();
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("DC_PRED TOP");
|
||||
FillRandom();
|
||||
SetTopUnavailable();
|
||||
Predict(DC_PRED);
|
||||
CheckDCPrediction();
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("DC_PRED TOP_LEFT");
|
||||
FillRandom();
|
||||
SetTopLeftUnavailable();
|
||||
Predict(DC_PRED);
|
||||
CheckDCPrediction();
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("H_PRED");
|
||||
FillRandom();
|
||||
Predict(H_PRED);
|
||||
CheckHPrediction();
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("V_PRED");
|
||||
FillRandom();
|
||||
Predict(V_PRED);
|
||||
CheckVPrediction();
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("TM_PRED");
|
||||
FillRandom();
|
||||
Predict(TM_PRED);
|
||||
CheckTMPrediction();
|
||||
}
|
||||
}
|
||||
|
||||
MACROBLOCKD mb_;
|
||||
MODE_INFO mi_;
|
||||
uint8_t *data_ptr_[2]; // in the case of Y, only [0] is used
|
||||
int stride_;
|
||||
int block_size_;
|
||||
int num_planes_;
|
||||
};
|
||||
|
||||
typedef void (*intra_pred_y_fn_t)(MACROBLOCKD *x,
|
||||
uint8_t *yabove_row,
|
||||
uint8_t *yleft,
|
||||
int left_stride,
|
||||
uint8_t *ypred_ptr,
|
||||
int y_stride);
|
||||
|
||||
class IntraPredYTest : public ::testing::TestWithParam<intra_pred_y_fn_t>,
|
||||
protected IntraPredBase {
|
||||
public:
|
||||
static void SetUpTestCase() {
|
||||
data_array_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
vpx_free(data_array_);
|
||||
data_array_ = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int kBlockSize = 16;
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kStride = kBlockSize * 3;
|
||||
// We use 48 so that the data pointer of the first pixel in each row of
|
||||
// each macroblock is 16-byte aligned, and this gives us access to the
|
||||
// top-left and top-right corner pixels belonging to the top-left/right
|
||||
// macroblocks.
|
||||
// We use 17 lines so we have one line above us for top-prediction.
|
||||
static const int kDataBufferSize = kStride * (kBlockSize + 1);
|
||||
|
||||
virtual void SetUp() {
|
||||
pred_fn_ = GetParam();
|
||||
SetupMacroblock(data_array_, kBlockSize, kStride, 1);
|
||||
}
|
||||
|
||||
virtual void Predict(MB_PREDICTION_MODE mode) {
|
||||
mb_.mode_info_context->mbmi.mode = mode;
|
||||
REGISTER_STATE_CHECK(pred_fn_(&mb_,
|
||||
data_ptr_[0] - kStride,
|
||||
data_ptr_[0] - 1, kStride,
|
||||
data_ptr_[0], kStride));
|
||||
}
|
||||
|
||||
intra_pred_y_fn_t pred_fn_;
|
||||
static uint8_t* data_array_;
|
||||
};
|
||||
|
||||
uint8_t* IntraPredYTest::data_array_ = NULL;
|
||||
|
||||
TEST_P(IntraPredYTest, IntraPredTests) {
|
||||
RunTest();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, IntraPredYTest,
|
||||
::testing::Values(
|
||||
vp8_build_intra_predictors_mby_s_c));
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, IntraPredYTest,
|
||||
::testing::Values(
|
||||
vp8_build_intra_predictors_mby_s_sse2));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, IntraPredYTest,
|
||||
::testing::Values(
|
||||
vp8_build_intra_predictors_mby_s_ssse3));
|
||||
#endif
|
||||
|
||||
typedef void (*intra_pred_uv_fn_t)(MACROBLOCKD *x,
|
||||
uint8_t *uabove_row,
|
||||
uint8_t *vabove_row,
|
||||
uint8_t *uleft,
|
||||
uint8_t *vleft,
|
||||
int left_stride,
|
||||
uint8_t *upred_ptr,
|
||||
uint8_t *vpred_ptr,
|
||||
int pred_stride);
|
||||
|
||||
class IntraPredUVTest : public ::testing::TestWithParam<intra_pred_uv_fn_t>,
|
||||
protected IntraPredBase {
|
||||
public:
|
||||
static void SetUpTestCase() {
|
||||
data_array_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
vpx_free(data_array_);
|
||||
data_array_ = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int kBlockSize = 8;
|
||||
static const int kDataAlignment = 8;
|
||||
static const int kStride = kBlockSize * 3;
|
||||
// We use 24 so that the data pointer of the first pixel in each row of
|
||||
// each macroblock is 8-byte aligned, and this gives us access to the
|
||||
// top-left and top-right corner pixels belonging to the top-left/right
|
||||
// macroblocks.
|
||||
// We use 9 lines so we have one line above us for top-prediction.
|
||||
// [0] = U, [1] = V
|
||||
static const int kDataBufferSize = 2 * kStride * (kBlockSize + 1);
|
||||
|
||||
virtual void SetUp() {
|
||||
pred_fn_ = GetParam();
|
||||
SetupMacroblock(data_array_, kBlockSize, kStride, 2);
|
||||
}
|
||||
|
||||
virtual void Predict(MB_PREDICTION_MODE mode) {
|
||||
mb_.mode_info_context->mbmi.uv_mode = mode;
|
||||
pred_fn_(&mb_, data_ptr_[0] - kStride, data_ptr_[1] - kStride,
|
||||
data_ptr_[0] - 1, data_ptr_[1] - 1, kStride,
|
||||
data_ptr_[0], data_ptr_[1], kStride);
|
||||
}
|
||||
|
||||
intra_pred_uv_fn_t pred_fn_;
|
||||
// We use 24 so that the data pointer of the first pixel in each row of
|
||||
// each macroblock is 8-byte aligned, and this gives us access to the
|
||||
// top-left and top-right corner pixels belonging to the top-left/right
|
||||
// macroblocks.
|
||||
// We use 9 lines so we have one line above us for top-prediction.
|
||||
// [0] = U, [1] = V
|
||||
static uint8_t* data_array_;
|
||||
};
|
||||
|
||||
uint8_t* IntraPredUVTest::data_array_ = NULL;
|
||||
|
||||
TEST_P(IntraPredUVTest, IntraPredTests) {
|
||||
RunTest();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, IntraPredUVTest,
|
||||
::testing::Values(
|
||||
vp8_build_intra_predictors_mbuv_s_c));
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, IntraPredUVTest,
|
||||
::testing::Values(
|
||||
vp8_build_intra_predictors_mbuv_s_sse2));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, IntraPredUVTest,
|
||||
::testing::Values(
|
||||
vp8_build_intra_predictors_mbuv_s_ssse3));
|
||||
#endif
|
||||
|
||||
} // namespace
|
109
test/ivf_video_source.h
Normal file
109
test/ivf_video_source.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
#ifndef TEST_IVF_VIDEO_SOURCE_H_
|
||||
#define TEST_IVF_VIDEO_SOURCE_H_
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <string>
|
||||
#include "test/video_source.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
const unsigned int kCodeBufferSize = 256 * 1024;
|
||||
const unsigned int kIvfFileHdrSize = 32;
|
||||
const unsigned int kIvfFrameHdrSize = 12;
|
||||
|
||||
static unsigned int MemGetLe32(const uint8_t *mem) {
|
||||
return (mem[3] << 24) | (mem[2] << 16) | (mem[1] << 8) | (mem[0]);
|
||||
}
|
||||
|
||||
// This class extends VideoSource to allow parsing of ivf files,
|
||||
// so that we can do actual file decodes.
|
||||
class IVFVideoSource : public CompressedVideoSource {
|
||||
public:
|
||||
IVFVideoSource(const std::string &file_name)
|
||||
: file_name_(file_name),
|
||||
input_file_(NULL),
|
||||
compressed_frame_buf_(NULL),
|
||||
frame_sz_(0),
|
||||
frame_(0),
|
||||
end_of_file_(false) {
|
||||
}
|
||||
|
||||
virtual ~IVFVideoSource() {
|
||||
delete[] compressed_frame_buf_;
|
||||
|
||||
if (input_file_)
|
||||
fclose(input_file_);
|
||||
}
|
||||
|
||||
virtual void Init() {
|
||||
// Allocate a buffer for read in the compressed video frame.
|
||||
compressed_frame_buf_ = new uint8_t[libvpx_test::kCodeBufferSize];
|
||||
ASSERT_TRUE(compressed_frame_buf_) << "Allocate frame buffer failed";
|
||||
}
|
||||
|
||||
virtual void Begin() {
|
||||
input_file_ = OpenTestDataFile(file_name_);
|
||||
ASSERT_TRUE(input_file_) << "Input file open failed. Filename: "
|
||||
<< file_name_;
|
||||
|
||||
// Read file header
|
||||
uint8_t file_hdr[kIvfFileHdrSize];
|
||||
ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))
|
||||
<< "File header read failed.";
|
||||
// Check file header
|
||||
ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' && file_hdr[2] == 'I'
|
||||
&& file_hdr[3] == 'F') << "Input is not an IVF file.";
|
||||
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual void Next() {
|
||||
++frame_;
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
void FillFrame() {
|
||||
uint8_t frame_hdr[kIvfFrameHdrSize];
|
||||
// Check frame header and read a frame from input_file.
|
||||
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_)
|
||||
!= kIvfFrameHdrSize) {
|
||||
end_of_file_ = true;
|
||||
} else {
|
||||
end_of_file_ = false;
|
||||
|
||||
frame_sz_ = MemGetLe32(frame_hdr);
|
||||
ASSERT_LE(frame_sz_, kCodeBufferSize)
|
||||
<< "Frame is too big for allocated code buffer";
|
||||
ASSERT_EQ(frame_sz_,
|
||||
fread(compressed_frame_buf_, 1, frame_sz_, input_file_))
|
||||
<< "Failed to read complete frame";
|
||||
}
|
||||
}
|
||||
|
||||
virtual const uint8_t *cxdata() const {
|
||||
return end_of_file_ ? NULL : compressed_frame_buf_;
|
||||
}
|
||||
virtual const unsigned int frame_size() const { return frame_sz_; }
|
||||
virtual const unsigned int frame_number() const { return frame_; }
|
||||
|
||||
protected:
|
||||
std::string file_name_;
|
||||
FILE *input_file_;
|
||||
uint8_t *compressed_frame_buf_;
|
||||
unsigned int frame_sz_;
|
||||
unsigned int frame_;
|
||||
bool end_of_file_;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // TEST_IVF_VIDEO_SOURCE_H_
|
145
test/keyframe_test.cc
Normal file
145
test/keyframe_test.cc
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <climits>
|
||||
#include <vector>
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/i420_video_source.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class KeyframeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
kf_count_ = 0;
|
||||
kf_count_max_ = INT_MAX;
|
||||
kf_do_force_kf_ = false;
|
||||
set_cpu_used_ = 0;
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
|
||||
::libvpx_test::Encoder *encoder) {
|
||||
if (kf_do_force_kf_)
|
||||
frame_flags_ = (video->frame() % 3) ? 0 : VPX_EFLAG_FORCE_KF;
|
||||
if (set_cpu_used_ && video->frame() == 1)
|
||||
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
kf_pts_list_.push_back(pkt->data.frame.pts);
|
||||
kf_count_++;
|
||||
abort_ |= kf_count_ > kf_count_max_;
|
||||
}
|
||||
}
|
||||
|
||||
bool kf_do_force_kf_;
|
||||
int kf_count_;
|
||||
int kf_count_max_;
|
||||
std::vector<vpx_codec_pts_t> kf_pts_list_;
|
||||
int set_cpu_used_;
|
||||
};
|
||||
|
||||
TEST_P(KeyframeTest, TestRandomVideoSource) {
|
||||
// Validate that encoding the RandomVideoSource produces multiple keyframes.
|
||||
// This validates the results of the TestDisableKeyframes test.
|
||||
kf_count_max_ = 2; // early exit successful tests.
|
||||
|
||||
::libvpx_test::RandomVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// In realtime mode - auto placed keyframes are exceedingly rare, don't
|
||||
// bother with this check if(GetParam() > 0)
|
||||
if(GetParam() > 0)
|
||||
EXPECT_GT(kf_count_, 1);
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestDisableKeyframes) {
|
||||
cfg_.kf_mode = VPX_KF_DISABLED;
|
||||
kf_count_max_ = 1; // early exit failed tests.
|
||||
|
||||
::libvpx_test::RandomVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
EXPECT_EQ(1, kf_count_);
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestForceKeyframe) {
|
||||
cfg_.kf_mode = VPX_KF_DISABLED;
|
||||
kf_do_force_kf_ = true;
|
||||
|
||||
::libvpx_test::DummyVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// verify that every third frame is a keyframe.
|
||||
for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
|
||||
iter != kf_pts_list_.end(); ++iter) {
|
||||
ASSERT_EQ(0, *iter % 3) << "Unexpected keyframe at frame " << *iter;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestKeyframeMaxDistance) {
|
||||
cfg_.kf_max_dist = 25;
|
||||
|
||||
::libvpx_test::DummyVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// verify that keyframe interval matches kf_max_dist
|
||||
for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
|
||||
iter != kf_pts_list_.end(); ++iter) {
|
||||
ASSERT_EQ(0, *iter % 25) << "Unexpected keyframe at frame " << *iter;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(KeyframeTest, TestAutoKeyframe) {
|
||||
cfg_.kf_mode = VPX_KF_AUTO;
|
||||
kf_do_force_kf_ = false;
|
||||
|
||||
// Force a deterministic speed step in Real Time mode, as the faster modes
|
||||
// may not produce a keyframe like we expect. This is necessary when running
|
||||
// on very slow environments (like Valgrind). The step -11 was determined
|
||||
// experimentally as the fastest mode that still throws the keyframe.
|
||||
if (deadline_ == VPX_DL_REALTIME)
|
||||
set_cpu_used_ = -11;
|
||||
|
||||
// This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120.
|
||||
// I check only the first 40 frames to make sure there's a keyframe at frame
|
||||
// 0 and 30.
|
||||
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
|
||||
30, 1, 0, 40);
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
// In realtime mode - auto placed keyframes are exceedingly rare, don't
|
||||
// bother with this check
|
||||
if(GetParam() > 0)
|
||||
EXPECT_EQ(2u, kf_pts_list_.size()) << " Not the right number of keyframes ";
|
||||
|
||||
// Verify that keyframes match the file keyframes in the file.
|
||||
for (std::vector<vpx_codec_pts_t>::const_iterator iter = kf_pts_list_.begin();
|
||||
iter != kf_pts_list_.end(); ++iter) {
|
||||
|
||||
if (deadline_ == VPX_DL_REALTIME && *iter > 0)
|
||||
EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
|
||||
<< *iter;
|
||||
else
|
||||
EXPECT_EQ(0, *iter % 30) << "Unexpected keyframe at frame " << *iter;
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllModes, KeyframeTest, ALL_TEST_MODES);
|
||||
} // namespace
|
107
test/pp_filter_test.cc
Normal file
107
test/pp_filter_test.cc
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "test/register_state_check.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
extern "C" {
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
typedef void (*post_proc_func_t)(unsigned char *src_ptr,
|
||||
unsigned char *dst_ptr,
|
||||
int src_pixels_per_line,
|
||||
int dst_pixels_per_line,
|
||||
int cols,
|
||||
unsigned char *flimit,
|
||||
int size);
|
||||
|
||||
namespace {
|
||||
|
||||
class Vp8PostProcessingFilterTest
|
||||
: public ::testing::TestWithParam<post_proc_func_t> {};
|
||||
|
||||
// Test routine for the VP8 post-processing function
|
||||
// vp8_post_proc_down_and_across_mb_row_c.
|
||||
|
||||
TEST_P(Vp8PostProcessingFilterTest, FilterOutputCheck) {
|
||||
// Size of the underlying data block that will be filtered.
|
||||
const int block_width = 16;
|
||||
const int block_height = 16;
|
||||
|
||||
// 5-tap filter needs 2 padding rows above and below the block in the input.
|
||||
const int input_width = block_width;
|
||||
const int input_height = block_height + 4;
|
||||
const int input_stride = input_width;
|
||||
const int input_size = input_width * input_height;
|
||||
|
||||
// Filter extends output block by 8 samples at left and right edges.
|
||||
const int output_width = block_width + 16;
|
||||
const int output_height = block_height;
|
||||
const int output_stride = output_width;
|
||||
const int output_size = output_width * output_height;
|
||||
|
||||
uint8_t *const src_image =
|
||||
reinterpret_cast<uint8_t*>(vpx_calloc(input_size, 1));
|
||||
uint8_t *const dst_image =
|
||||
reinterpret_cast<uint8_t*>(vpx_calloc(output_size, 1));
|
||||
|
||||
// Pointers to top-left pixel of block in the input and output images.
|
||||
uint8_t *const src_image_ptr = src_image + (input_stride << 1);
|
||||
uint8_t *const dst_image_ptr = dst_image + 8;
|
||||
uint8_t *const flimits = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));
|
||||
(void)vpx_memset(flimits, 255, block_width);
|
||||
|
||||
// Initialize pixels in the input:
|
||||
// block pixels to value 1,
|
||||
// border pixels to value 10.
|
||||
(void)vpx_memset(src_image, 10, input_size);
|
||||
uint8_t *pixel_ptr = src_image_ptr;
|
||||
for (int i = 0; i < block_height; ++i) {
|
||||
for (int j = 0; j < block_width; ++j) {
|
||||
pixel_ptr[j] = 1;
|
||||
}
|
||||
pixel_ptr += input_stride;
|
||||
}
|
||||
|
||||
// Initialize pixels in the output to 99.
|
||||
(void)vpx_memset(dst_image, 99, output_size);
|
||||
|
||||
REGISTER_STATE_CHECK(GetParam()(src_image_ptr, dst_image_ptr, input_stride,
|
||||
output_stride, block_width, flimits, 16));
|
||||
|
||||
static const uint8_t expected_data[block_height] = {
|
||||
4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4
|
||||
};
|
||||
|
||||
pixel_ptr = dst_image_ptr;
|
||||
for (int i = 0; i < block_height; ++i) {
|
||||
for (int j = 0; j < block_width; ++j) {
|
||||
EXPECT_EQ(expected_data[i], pixel_ptr[j])
|
||||
<< "Vp8PostProcessingFilterTest failed with invalid filter output";
|
||||
}
|
||||
pixel_ptr += output_stride;
|
||||
}
|
||||
|
||||
vpx_free(src_image);
|
||||
vpx_free(dst_image);
|
||||
vpx_free(flimits);
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, Vp8PostProcessingFilterTest,
|
||||
::testing::Values(vp8_post_proc_down_and_across_mb_row_c));
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, Vp8PostProcessingFilterTest,
|
||||
::testing::Values(vp8_post_proc_down_and_across_mb_row_sse2));
|
||||
#endif
|
||||
|
||||
} // namespace
|
95
test/register_state_check.h
Normal file
95
test/register_state_check.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
#ifndef LIBVPX_TEST_REGISTER_STATE_CHECK_H_
|
||||
#define LIBVPX_TEST_REGISTER_STATE_CHECK_H_
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
#define _WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winnt.h>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
namespace testing {
|
||||
namespace internal {
|
||||
|
||||
inline bool operator==(const M128A& lhs, const M128A& rhs) {
|
||||
return (lhs.Low == rhs.Low && lhs.High == rhs.High);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace testing
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
// Compares the state of xmm[6-15] at construction with their state at
|
||||
// destruction. These registers should be preserved by the callee on
|
||||
// Windows x64.
|
||||
// Usage:
|
||||
// {
|
||||
// RegisterStateCheck reg_check;
|
||||
// FunctionToVerify();
|
||||
// }
|
||||
class RegisterStateCheck {
|
||||
public:
|
||||
RegisterStateCheck() { initialized_ = StoreRegisters(&pre_context_); }
|
||||
~RegisterStateCheck() { EXPECT_TRUE(Check()); }
|
||||
|
||||
private:
|
||||
static bool StoreRegisters(CONTEXT* const context) {
|
||||
const HANDLE this_thread = GetCurrentThread();
|
||||
EXPECT_TRUE(this_thread != NULL);
|
||||
context->ContextFlags = CONTEXT_FLOATING_POINT;
|
||||
const bool context_saved = GetThreadContext(this_thread, context) == TRUE;
|
||||
EXPECT_TRUE(context_saved) << "GetLastError: " << GetLastError();
|
||||
return context_saved;
|
||||
}
|
||||
|
||||
// Compares the register state. Returns true if the states match.
|
||||
bool Check() const {
|
||||
if (!initialized_) return false;
|
||||
CONTEXT post_context;
|
||||
if (!StoreRegisters(&post_context)) return false;
|
||||
|
||||
const M128A* xmm_pre = &pre_context_.Xmm6;
|
||||
const M128A* xmm_post = &post_context.Xmm6;
|
||||
for (int i = 6; i <= 15; ++i) {
|
||||
EXPECT_EQ(*xmm_pre, *xmm_post) << "xmm" << i << " has been modified!";
|
||||
++xmm_pre;
|
||||
++xmm_post;
|
||||
}
|
||||
return !testing::Test::HasNonfatalFailure();
|
||||
}
|
||||
|
||||
bool initialized_;
|
||||
CONTEXT pre_context_;
|
||||
};
|
||||
|
||||
#define REGISTER_STATE_CHECK(statement) do { \
|
||||
libvpx_test::RegisterStateCheck reg_check; \
|
||||
statement; \
|
||||
} while (false)
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#else // !_WIN64
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
class RegisterStateCheck {};
|
||||
#define REGISTER_STATE_CHECK(statement) statement
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // _WIN64
|
||||
|
||||
#endif // LIBVPX_TEST_REGISTER_STATE_CHECK_H_
|
104
test/resize_test.cc
Normal file
104
test/resize_test.cc
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <climits>
|
||||
#include <vector>
|
||||
#include "test/encode_test_driver.h"
|
||||
#include "test/video_source.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const unsigned int kInitialWidth = 320;
|
||||
const unsigned int kInitialHeight = 240;
|
||||
|
||||
unsigned int ScaleForFrameNumber(unsigned int frame, unsigned int val) {
|
||||
if (frame < 10)
|
||||
return val;
|
||||
if (frame < 20)
|
||||
return val / 2;
|
||||
if (frame < 30)
|
||||
return val * 2 / 3;
|
||||
if (frame < 40)
|
||||
return val / 4;
|
||||
if (frame < 50)
|
||||
return val * 7 / 8;
|
||||
return val;
|
||||
}
|
||||
|
||||
class ResizingVideoSource : public ::libvpx_test::DummyVideoSource {
|
||||
public:
|
||||
ResizingVideoSource() {
|
||||
SetSize(kInitialWidth, kInitialHeight);
|
||||
limit_ = 60;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void Next() {
|
||||
++frame_;
|
||||
SetSize(ScaleForFrameNumber(frame_, kInitialWidth),
|
||||
ScaleForFrameNumber(frame_, kInitialHeight));
|
||||
FillFrame();
|
||||
}
|
||||
};
|
||||
|
||||
class ResizeTest : public ::libvpx_test::EncoderTest,
|
||||
public ::testing::TestWithParam<enum libvpx_test::TestMode> {
|
||||
protected:
|
||||
struct FrameInfo {
|
||||
FrameInfo(vpx_codec_pts_t _pts, unsigned int _w, unsigned int _h)
|
||||
: pts(_pts), w(_w), h(_h) {}
|
||||
|
||||
vpx_codec_pts_t pts;
|
||||
unsigned int w;
|
||||
unsigned int h;
|
||||
};
|
||||
|
||||
virtual void SetUp() {
|
||||
InitializeConfig();
|
||||
SetMode(GetParam());
|
||||
}
|
||||
|
||||
virtual bool Continue() const {
|
||||
return !HasFatalFailure() && !abort_;
|
||||
}
|
||||
|
||||
virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
|
||||
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
|
||||
const unsigned char *buf =
|
||||
reinterpret_cast<const unsigned char *>(pkt->data.frame.buf);
|
||||
const unsigned int w = (buf[6] | (buf[7] << 8)) & 0x3fff;
|
||||
const unsigned int h = (buf[8] | (buf[9] << 8)) & 0x3fff;
|
||||
|
||||
frame_info_list_.push_back(FrameInfo(pkt->data.frame.pts, w, h));
|
||||
}
|
||||
}
|
||||
|
||||
std::vector< FrameInfo > frame_info_list_;
|
||||
};
|
||||
|
||||
TEST_P(ResizeTest, TestExternalResizeWorks) {
|
||||
ResizingVideoSource video;
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
|
||||
for (std::vector<FrameInfo>::iterator info = frame_info_list_.begin();
|
||||
info != frame_info_list_.end(); ++info) {
|
||||
const vpx_codec_pts_t pts = info->pts;
|
||||
const unsigned int expected_w = ScaleForFrameNumber(pts, kInitialWidth);
|
||||
const unsigned int expected_h = ScaleForFrameNumber(pts, kInitialHeight);
|
||||
|
||||
EXPECT_EQ(expected_w, info->w)
|
||||
<< "Frame " << pts << "had unexpected width";
|
||||
EXPECT_EQ(expected_h, info->h)
|
||||
<< "Frame " << pts << "had unexpected height";
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(OnePass, ResizeTest, ONE_PASS_TEST_MODES);
|
||||
} // namespace
|
253
test/sad_test.cc
Normal file
253
test/sad_test.cc
Normal file
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <string.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" {
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_rtcd.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
#include "test/acm_random.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
|
||||
typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr,
|
||||
int source_stride,
|
||||
const unsigned char *reference_ptr,
|
||||
int reference_stride,
|
||||
unsigned int max_sad);
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace {
|
||||
class SADTest : public PARAMS(int, int, sad_m_by_n_fn_t) {
|
||||
public:
|
||||
static void SetUpTestCase() {
|
||||
source_data_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
reference_data_ = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(kDataAlignment, kDataBufferSize));
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
vpx_free(source_data_);
|
||||
source_data_ = NULL;
|
||||
vpx_free(reference_data_);
|
||||
reference_data_ = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kDataBufferSize = 16 * 32;
|
||||
|
||||
virtual void SetUp() {
|
||||
sad_fn_ = GET_PARAM(2);
|
||||
height_ = GET_PARAM(1);
|
||||
width_ = GET_PARAM(0);
|
||||
source_stride_ = width_ * 2;
|
||||
reference_stride_ = width_ * 2;
|
||||
rnd_.Reset(ACMRandom::DeterministicSeed());
|
||||
}
|
||||
|
||||
sad_m_by_n_fn_t sad_fn_;
|
||||
virtual unsigned int SAD(unsigned int max_sad) {
|
||||
unsigned int ret;
|
||||
REGISTER_STATE_CHECK(ret = sad_fn_(source_data_, source_stride_,
|
||||
reference_data_, reference_stride_,
|
||||
max_sad));
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Sum of Absolute Differences. Given two blocks, calculate the absolute
|
||||
// difference between two pixels in the same relative location; accumulate.
|
||||
unsigned int ReferenceSAD(unsigned int max_sad) {
|
||||
unsigned int sad = 0;
|
||||
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
sad += abs(source_data_[h * source_stride_ + w]
|
||||
- reference_data_[h * reference_stride_ + w]);
|
||||
}
|
||||
if (sad > max_sad) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sad;
|
||||
}
|
||||
|
||||
void FillConstant(uint8_t *data, int stride, uint8_t fill_constant) {
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
data[h * stride + w] = fill_constant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FillRandom(uint8_t *data, int stride) {
|
||||
for (int h = 0; h < height_; ++h) {
|
||||
for (int w = 0; w < width_; ++w) {
|
||||
data[h * stride + w] = rnd_.Rand8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CheckSad(unsigned int max_sad) {
|
||||
unsigned int reference_sad, exp_sad;
|
||||
|
||||
reference_sad = ReferenceSAD(max_sad);
|
||||
exp_sad = SAD(max_sad);
|
||||
|
||||
if (reference_sad <= max_sad) {
|
||||
ASSERT_EQ(exp_sad, reference_sad);
|
||||
} else {
|
||||
// Alternative implementations are not required to check max_sad
|
||||
ASSERT_GE(exp_sad, reference_sad);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle blocks up to 16x16 with stride up to 32
|
||||
int height_, width_;
|
||||
static uint8_t* source_data_;
|
||||
int source_stride_;
|
||||
static uint8_t* reference_data_;
|
||||
int reference_stride_;
|
||||
|
||||
ACMRandom rnd_;
|
||||
};
|
||||
|
||||
uint8_t* SADTest::source_data_ = NULL;
|
||||
uint8_t* SADTest::reference_data_ = NULL;
|
||||
|
||||
TEST_P(SADTest, MaxRef) {
|
||||
FillConstant(source_data_, source_stride_, 0);
|
||||
FillConstant(reference_data_, reference_stride_, 255);
|
||||
CheckSad(UINT_MAX);
|
||||
}
|
||||
|
||||
TEST_P(SADTest, MaxSrc) {
|
||||
FillConstant(source_data_, source_stride_, 255);
|
||||
FillConstant(reference_data_, reference_stride_, 0);
|
||||
CheckSad(UINT_MAX);
|
||||
}
|
||||
|
||||
TEST_P(SADTest, ShortRef) {
|
||||
int tmp_stride = reference_stride_;
|
||||
reference_stride_ >>= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(reference_data_, reference_stride_);
|
||||
CheckSad(UINT_MAX);
|
||||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADTest, UnalignedRef) {
|
||||
// The reference frame, but not the source frame, may be unaligned for
|
||||
// certain types of searches.
|
||||
int tmp_stride = reference_stride_;
|
||||
reference_stride_ -= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(reference_data_, reference_stride_);
|
||||
CheckSad(UINT_MAX);
|
||||
reference_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADTest, ShortSrc) {
|
||||
int tmp_stride = source_stride_;
|
||||
source_stride_ >>= 1;
|
||||
FillRandom(source_data_, source_stride_);
|
||||
FillRandom(reference_data_, reference_stride_);
|
||||
CheckSad(UINT_MAX);
|
||||
source_stride_ = tmp_stride;
|
||||
}
|
||||
|
||||
TEST_P(SADTest, MaxSAD) {
|
||||
// Verify that, when max_sad is set, the implementation does not return a
|
||||
// value lower than the reference.
|
||||
FillConstant(source_data_, source_stride_, 255);
|
||||
FillConstant(reference_data_, reference_stride_, 0);
|
||||
CheckSad(128);
|
||||
}
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
const sad_m_by_n_fn_t sad_16x16_c = vp8_sad16x16_c;
|
||||
const sad_m_by_n_fn_t sad_8x16_c = vp8_sad8x16_c;
|
||||
const sad_m_by_n_fn_t sad_16x8_c = vp8_sad16x8_c;
|
||||
const sad_m_by_n_fn_t sad_8x8_c = vp8_sad8x8_c;
|
||||
const sad_m_by_n_fn_t sad_4x4_c = vp8_sad4x4_c;
|
||||
INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::Values(
|
||||
make_tuple(16, 16, sad_16x16_c),
|
||||
make_tuple(8, 16, sad_8x16_c),
|
||||
make_tuple(16, 8, sad_16x8_c),
|
||||
make_tuple(8, 8, sad_8x8_c),
|
||||
make_tuple(4, 4, sad_4x4_c)));
|
||||
|
||||
// ARM tests
|
||||
#if HAVE_MEDIA
|
||||
const sad_m_by_n_fn_t sad_16x16_armv6 = vp8_sad16x16_armv6;
|
||||
INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::Values(
|
||||
make_tuple(16, 16, sad_16x16_armv6)));
|
||||
|
||||
#endif
|
||||
#if HAVE_NEON
|
||||
const sad_m_by_n_fn_t sad_16x16_neon = vp8_sad16x16_neon;
|
||||
const sad_m_by_n_fn_t sad_8x16_neon = vp8_sad8x16_neon;
|
||||
const sad_m_by_n_fn_t sad_16x8_neon = vp8_sad16x8_neon;
|
||||
const sad_m_by_n_fn_t sad_8x8_neon = vp8_sad8x8_neon;
|
||||
const sad_m_by_n_fn_t sad_4x4_neon = vp8_sad4x4_neon;
|
||||
INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values(
|
||||
make_tuple(16, 16, sad_16x16_neon),
|
||||
make_tuple(8, 16, sad_8x16_neon),
|
||||
make_tuple(16, 8, sad_16x8_neon),
|
||||
make_tuple(8, 8, sad_8x8_neon),
|
||||
make_tuple(4, 4, sad_4x4_neon)));
|
||||
#endif
|
||||
|
||||
// X86 tests
|
||||
#if HAVE_MMX
|
||||
const sad_m_by_n_fn_t sad_16x16_mmx = vp8_sad16x16_mmx;
|
||||
const sad_m_by_n_fn_t sad_8x16_mmx = vp8_sad8x16_mmx;
|
||||
const sad_m_by_n_fn_t sad_16x8_mmx = vp8_sad16x8_mmx;
|
||||
const sad_m_by_n_fn_t sad_8x8_mmx = vp8_sad8x8_mmx;
|
||||
const sad_m_by_n_fn_t sad_4x4_mmx = vp8_sad4x4_mmx;
|
||||
INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::Values(
|
||||
make_tuple(16, 16, sad_16x16_mmx),
|
||||
make_tuple(8, 16, sad_8x16_mmx),
|
||||
make_tuple(16, 8, sad_16x8_mmx),
|
||||
make_tuple(8, 8, sad_8x8_mmx),
|
||||
make_tuple(4, 4, sad_4x4_mmx)));
|
||||
#endif
|
||||
#if HAVE_SSE2
|
||||
const sad_m_by_n_fn_t sad_16x16_wmt = vp8_sad16x16_wmt;
|
||||
const sad_m_by_n_fn_t sad_8x16_wmt = vp8_sad8x16_wmt;
|
||||
const sad_m_by_n_fn_t sad_16x8_wmt = vp8_sad16x8_wmt;
|
||||
const sad_m_by_n_fn_t sad_8x8_wmt = vp8_sad8x8_wmt;
|
||||
const sad_m_by_n_fn_t sad_4x4_wmt = vp8_sad4x4_wmt;
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::Values(
|
||||
make_tuple(16, 16, sad_16x16_wmt),
|
||||
make_tuple(8, 16, sad_8x16_wmt),
|
||||
make_tuple(16, 8, sad_16x8_wmt),
|
||||
make_tuple(8, 8, sad_8x8_wmt),
|
||||
make_tuple(4, 4, sad_4x4_wmt)));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3;
|
||||
INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
|
||||
make_tuple(16, 16, sad_16x16_sse3)));
|
||||
#endif
|
||||
|
||||
} // namespace
|
182
test/set_roi.cc
Normal file
182
test/set_roi.cc
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
extern "C" {
|
||||
#include "vp8/encoder/onyx_int.h"
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(Vp8RoiMapTest, ParameterCheck) {
|
||||
int delta_q[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
|
||||
int delta_lf[MAX_MB_SEGMENTS] = { -2, -25, 0, 31 };
|
||||
unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
|
||||
|
||||
const int internalq_trans[] = {
|
||||
0, 1, 2, 3, 4, 5, 7, 8,
|
||||
9, 10, 12, 13, 15, 17, 18, 19,
|
||||
20, 21, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 33, 35, 37, 39, 41,
|
||||
43, 45, 47, 49, 51, 53, 55, 57,
|
||||
59, 61, 64, 67, 70, 73, 76, 79,
|
||||
82, 85, 88, 91, 94, 97, 100, 103,
|
||||
106, 109, 112, 115, 118, 121, 124, 127,
|
||||
};
|
||||
|
||||
// Initialize elements of cpi with valid defaults.
|
||||
VP8_COMP cpi;
|
||||
cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA;
|
||||
cpi.cyclic_refresh_mode_enabled = 0;
|
||||
cpi.mb.e_mbd.segmentation_enabled = 0;
|
||||
cpi.mb.e_mbd.update_mb_segmentation_map = 0;
|
||||
cpi.mb.e_mbd.update_mb_segmentation_data = 0;
|
||||
cpi.common.mb_rows = 240 >> 4;
|
||||
cpi.common.mb_cols = 320 >> 4;
|
||||
const int mbs = (cpi.common.mb_rows * cpi.common.mb_cols);
|
||||
vpx_memset(cpi.segment_feature_data, 0, sizeof(cpi.segment_feature_data));
|
||||
|
||||
// Segment map
|
||||
cpi.segmentation_map = reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
|
||||
|
||||
// Allocate memory for the source memory map.
|
||||
unsigned char *roi_map =
|
||||
reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
|
||||
vpx_memset(&roi_map[mbs >> 2], 1, (mbs >> 2));
|
||||
vpx_memset(&roi_map[mbs >> 1], 2, (mbs >> 2));
|
||||
vpx_memset(&roi_map[mbs -(mbs >> 2)], 3, (mbs >> 2));
|
||||
|
||||
// Do a test call with valid parameters.
|
||||
int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q, delta_lf,
|
||||
threshold);
|
||||
EXPECT_EQ(0, roi_retval)
|
||||
<< "vp8_set_roimap roi failed with default test parameters";
|
||||
|
||||
// Check that the values in the cpi structure get set as expected.
|
||||
if (roi_retval == 0) {
|
||||
// Check that the segment map got set.
|
||||
const int mapcompare = memcmp(roi_map, cpi.segmentation_map, mbs);
|
||||
EXPECT_EQ(0, mapcompare) << "segment map error";
|
||||
|
||||
// Check the q deltas (note the need to translate into
|
||||
// the interanl range of 0-127.
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
const int transq = internalq_trans[abs(delta_q[i])];
|
||||
if (abs(cpi.segment_feature_data[MB_LVL_ALT_Q][i]) != transq) {
|
||||
EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])
|
||||
<< "segment delta_q error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the loop filter deltas
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
if (cpi.segment_feature_data[MB_LVL_ALT_LF][i] != delta_lf[i]) {
|
||||
EXPECT_EQ(delta_lf[i], cpi.segment_feature_data[MB_LVL_ALT_LF][i])
|
||||
<< "segment delta_lf error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the breakout thresholds
|
||||
for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
|
||||
unsigned int breakout =
|
||||
static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
|
||||
|
||||
if (threshold[i] != breakout) {
|
||||
EXPECT_EQ(threshold[i], breakout)
|
||||
<< "breakout threshold error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Segmentation, and segmentation update flages should be set.
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.segmentation_enabled)
|
||||
<< "segmentation_enabled error";
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_map)
|
||||
<< "update_mb_segmentation_map error";
|
||||
EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data)
|
||||
<< "update_mb_segmentation_data error";
|
||||
|
||||
|
||||
// Try a range of delta q and lf parameters (some legal, some not)
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
int rand_deltas[4];
|
||||
int deltas_valid;
|
||||
rand_deltas[0] = (rand() % 160) - 80;
|
||||
rand_deltas[1] = (rand() % 160) - 80;
|
||||
rand_deltas[2] = (rand() % 160) - 80;
|
||||
rand_deltas[3] = (rand() % 160) - 80;
|
||||
|
||||
deltas_valid = ((abs(rand_deltas[0]) <= 63) &&
|
||||
(abs(rand_deltas[1]) <= 63) &&
|
||||
(abs(rand_deltas[2]) <= 63) &&
|
||||
(abs(rand_deltas[3]) <= 63)) ? 0 : -1;
|
||||
|
||||
// Test with random delta q values.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, rand_deltas,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";
|
||||
|
||||
// One delta_q error shown at a time
|
||||
if (deltas_valid != roi_retval)
|
||||
break;
|
||||
|
||||
// Test with random loop filter values.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
rand_deltas, threshold);
|
||||
EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";
|
||||
|
||||
// One delta loop filter error shown at a time
|
||||
if (deltas_valid != roi_retval)
|
||||
break;
|
||||
}
|
||||
|
||||
// Test that we report and error if cyclic refresh is enabled.
|
||||
cpi.cyclic_refresh_mode_enabled = 1;
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";
|
||||
cpi.cyclic_refresh_mode_enabled = 0;
|
||||
|
||||
// Test invalid number of rows or colums.
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
|
||||
cpi.common.mb_cols, delta_q,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";
|
||||
|
||||
roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
|
||||
cpi.common.mb_cols - 1, delta_q,
|
||||
delta_lf, threshold);
|
||||
EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";
|
||||
}
|
||||
|
||||
// Free allocated memory
|
||||
if (cpi.segmentation_map)
|
||||
vpx_free(cpi.segmentation_map);
|
||||
if (roi_map)
|
||||
vpx_free(roi_map);
|
||||
};
|
||||
|
||||
} // namespace
|
224
test/sixtap_predict_test.cc
Normal file
224
test/sixtap_predict_test.cc
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "test/acm_random.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "test/util.h"
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
extern "C" {
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_rtcd.h"
|
||||
#include "vpx/vpx_integer.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
typedef void (*sixtap_predict_fn_t)(uint8_t *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
uint8_t *dst_ptr,
|
||||
int dst_pitch);
|
||||
|
||||
class SixtapPredictTest : public PARAMS(int, int, sixtap_predict_fn_t) {
|
||||
public:
|
||||
static void SetUpTestCase() {
|
||||
src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize));
|
||||
dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));
|
||||
}
|
||||
|
||||
static void TearDownTestCase() {
|
||||
vpx_free(src_);
|
||||
src_ = NULL;
|
||||
vpx_free(dst_);
|
||||
dst_ = NULL;
|
||||
vpx_free(dst_c_);
|
||||
dst_c_ = NULL;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Make test arrays big enough for 16x16 functions. Six-tap filters
|
||||
// need 5 extra pixels outside of the macroblock.
|
||||
static const int kSrcStride = 21;
|
||||
static const int kDstStride = 16;
|
||||
static const int kDataAlignment = 16;
|
||||
static const int kSrcSize = kSrcStride * kSrcStride + 1;
|
||||
static const int kDstSize = kDstStride * kDstStride;
|
||||
|
||||
virtual void SetUp() {
|
||||
width_ = GET_PARAM(0);
|
||||
height_ = GET_PARAM(1);
|
||||
sixtap_predict_ = GET_PARAM(2);
|
||||
memset(src_, 0, sizeof(src_));
|
||||
memset(dst_, 0, sizeof(dst_));
|
||||
memset(dst_c_, 0, sizeof(dst_c_));
|
||||
}
|
||||
|
||||
int width_;
|
||||
int height_;
|
||||
sixtap_predict_fn_t sixtap_predict_;
|
||||
// The src stores the macroblock we will filter on, and makes it 1 byte larger
|
||||
// in order to test unaligned access. The result is stored in dst and dst_c(c
|
||||
// reference code result).
|
||||
static uint8_t* src_;
|
||||
static uint8_t* dst_;
|
||||
static uint8_t* dst_c_;
|
||||
};
|
||||
|
||||
uint8_t* SixtapPredictTest::src_ = NULL;
|
||||
uint8_t* SixtapPredictTest::dst_ = NULL;
|
||||
uint8_t* SixtapPredictTest::dst_c_ = NULL;
|
||||
|
||||
TEST_P(SixtapPredictTest, TestWithPresetData) {
|
||||
// Test input
|
||||
static const uint8_t test_data[kSrcSize] = {
|
||||
216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42, 226, 177,
|
||||
79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192, 44, 233, 120,
|
||||
48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110, 102, 171, 32,
|
||||
182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14, 3, 99, 247, 124,
|
||||
148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239, 58, 83, 155, 91, 10,
|
||||
166, 201, 115, 124, 5, 163, 104, 2, 231, 160, 16, 234, 4, 8, 103, 153,
|
||||
167, 174, 187, 26, 193, 109, 64, 141, 90, 48, 200, 174, 204, 36, 184,
|
||||
114, 237, 43, 238, 242, 207, 86, 245, 182, 247, 6, 161, 251, 14, 8, 148,
|
||||
182, 182, 79, 208, 120, 188, 17, 6, 23, 65, 206, 197, 13, 242, 126, 128,
|
||||
224, 170, 110, 211, 121, 197, 200, 47, 188, 207, 208, 184, 221, 216, 76,
|
||||
148, 143, 156, 100, 8, 89, 117, 14, 112, 183, 221, 54, 197, 208, 180, 69,
|
||||
176, 94, 180, 131, 215, 121, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142,
|
||||
64, 215, 242, 72, 49, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181,
|
||||
235, 224, 57, 195, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42,
|
||||
148, 145, 29, 221, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184,
|
||||
35, 181, 153, 93, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77,
|
||||
209, 76, 106, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221,
|
||||
223, 47, 118, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170,
|
||||
24, 226, 247, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13,
|
||||
93, 209, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69,
|
||||
49, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
|
||||
135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5, 36,
|
||||
119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83, 109, 35,
|
||||
93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204, 101, 77, 67, 52,
|
||||
53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125, 179, 115, 161, 17, 83,
|
||||
198, 101, 98, 85, 139, 3, 137, 75, 99, 178, 23, 201, 255, 91, 253, 52,
|
||||
134, 60, 138, 131, 208, 251, 101, 48, 2, 227, 228, 118, 132, 245, 202,
|
||||
75, 91, 44, 160, 231, 47, 41, 50, 147, 220, 74, 92, 219, 165, 89, 16
|
||||
};
|
||||
|
||||
// Expected result
|
||||
static const uint8_t expected_dst[kDstSize] = {
|
||||
117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39, 49, 38,
|
||||
105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85, 177, 164, 79,
|
||||
208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91, 154, 102, 102,
|
||||
159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224, 186, 36, 231,
|
||||
208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73, 201, 78, 149, 184,
|
||||
100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120, 129, 49, 25, 133,
|
||||
113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140, 78, 6, 55, 65, 240,
|
||||
255, 245, 184, 72, 90, 100, 116, 131, 39, 60, 234, 167, 33, 160, 88, 185,
|
||||
200, 157, 159, 176, 127, 151, 138, 102, 168, 106, 170, 86, 82, 219, 189,
|
||||
76, 33, 115, 197, 106, 96, 198, 136, 97, 141, 237, 151, 98, 137, 191,
|
||||
185, 2, 57, 95, 142, 91, 255, 185, 97, 137, 76, 162, 94, 173, 131, 193,
|
||||
161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95,
|
||||
15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196,
|
||||
84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166,
|
||||
189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180,
|
||||
224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75,
|
||||
136, 85, 189, 46, 71, 200, 90
|
||||
};
|
||||
|
||||
uint8_t *src = const_cast<uint8_t*>(test_data);
|
||||
|
||||
REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
2, 2, dst_, kDstStride));
|
||||
|
||||
for (int i = 0; i < height_; ++i)
|
||||
for (int j = 0; j < width_; ++j)
|
||||
ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j])
|
||||
<< "i==" << (i * width_ + j);
|
||||
}
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
TEST_P(SixtapPredictTest, TestWithRandomData) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
for (int i = 0; i < kSrcSize; ++i)
|
||||
src_[i] = rnd.Rand8();
|
||||
|
||||
// Run tests for all possible offsets.
|
||||
for (int xoffset = 0; xoffset < 8; ++xoffset) {
|
||||
for (int yoffset = 0; yoffset < 8; ++yoffset) {
|
||||
// Call c reference function.
|
||||
// Move start point to next pixel to test if the function reads
|
||||
// unaligned data correctly.
|
||||
vp8_sixtap_predict16x16_c(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
xoffset, yoffset, dst_c_, kDstStride);
|
||||
|
||||
// Run test.
|
||||
REGISTER_STATE_CHECK(
|
||||
sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,
|
||||
xoffset, yoffset, dst_, kDstStride));
|
||||
|
||||
for (int i = 0; i < height_; ++i)
|
||||
for (int j = 0; j < width_; ++j)
|
||||
ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j])
|
||||
<< "i==" << (i * width_ + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using std::tr1::make_tuple;
|
||||
|
||||
const sixtap_predict_fn_t sixtap_16x16_c = vp8_sixtap_predict16x16_c;
|
||||
const sixtap_predict_fn_t sixtap_8x8_c = vp8_sixtap_predict8x8_c;
|
||||
const sixtap_predict_fn_t sixtap_8x4_c = vp8_sixtap_predict8x4_c;
|
||||
const sixtap_predict_fn_t sixtap_4x4_c = vp8_sixtap_predict4x4_c;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
C, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, sixtap_16x16_c),
|
||||
make_tuple(8, 8, sixtap_8x8_c),
|
||||
make_tuple(8, 4, sixtap_8x4_c),
|
||||
make_tuple(4, 4, sixtap_4x4_c)));
|
||||
#if HAVE_MMX
|
||||
const sixtap_predict_fn_t sixtap_16x16_mmx = vp8_sixtap_predict16x16_mmx;
|
||||
const sixtap_predict_fn_t sixtap_8x8_mmx = vp8_sixtap_predict8x8_mmx;
|
||||
const sixtap_predict_fn_t sixtap_8x4_mmx = vp8_sixtap_predict8x4_mmx;
|
||||
const sixtap_predict_fn_t sixtap_4x4_mmx = vp8_sixtap_predict4x4_mmx;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
MMX, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, sixtap_16x16_mmx),
|
||||
make_tuple(8, 8, sixtap_8x8_mmx),
|
||||
make_tuple(8, 4, sixtap_8x4_mmx),
|
||||
make_tuple(4, 4, sixtap_4x4_mmx)));
|
||||
#endif
|
||||
#if HAVE_SSE2
|
||||
const sixtap_predict_fn_t sixtap_16x16_sse2 = vp8_sixtap_predict16x16_sse2;
|
||||
const sixtap_predict_fn_t sixtap_8x8_sse2 = vp8_sixtap_predict8x8_sse2;
|
||||
const sixtap_predict_fn_t sixtap_8x4_sse2 = vp8_sixtap_predict8x4_sse2;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, sixtap_16x16_sse2),
|
||||
make_tuple(8, 8, sixtap_8x8_sse2),
|
||||
make_tuple(8, 4, sixtap_8x4_sse2)));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
const sixtap_predict_fn_t sixtap_16x16_ssse3 = vp8_sixtap_predict16x16_ssse3;
|
||||
const sixtap_predict_fn_t sixtap_8x8_ssse3 = vp8_sixtap_predict8x8_ssse3;
|
||||
const sixtap_predict_fn_t sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3;
|
||||
const sixtap_predict_fn_t sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3;
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, SixtapPredictTest, ::testing::Values(
|
||||
make_tuple(16, 16, sixtap_16x16_ssse3),
|
||||
make_tuple(8, 8, sixtap_8x8_ssse3),
|
||||
make_tuple(8, 4, sixtap_8x4_ssse3),
|
||||
make_tuple(4, 4, sixtap_4x4_ssse3)));
|
||||
#endif
|
||||
} // namespace
|
114
test/subtract_test.cc
Normal file
114
test/subtract_test.cc
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/register_state_check.h"
|
||||
extern "C" {
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
#include "vp8/encoder/block.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
typedef void (*subtract_b_fn_t)(BLOCK *be, BLOCKD *bd, int pitch);
|
||||
|
||||
namespace {
|
||||
|
||||
class SubtractBlockTest : public ::testing::TestWithParam<subtract_b_fn_t> {};
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
TEST_P(SubtractBlockTest, SimpleSubtract) {
|
||||
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
||||
BLOCK be;
|
||||
BLOCKD bd;
|
||||
// in libvpx, this stride is always 16
|
||||
const int kDiffPredStride = 16;
|
||||
const int kSrcStride[] = {32, 16, 8, 4, 0};
|
||||
const int kBlockWidth = 4;
|
||||
const int kBlockHeight = 4;
|
||||
|
||||
// Allocate... align to 16 for mmx/sse tests
|
||||
uint8_t *source = reinterpret_cast<uint8_t*>(
|
||||
vpx_memalign(16, kBlockHeight * kSrcStride[0] * sizeof(*source)));
|
||||
be.src_diff = reinterpret_cast<int16_t*>(
|
||||
vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*be.src_diff)));
|
||||
bd.predictor = reinterpret_cast<unsigned char*>(
|
||||
vpx_memalign(16, kBlockHeight * kDiffPredStride * sizeof(*bd.predictor)));
|
||||
|
||||
for(int i = 0; kSrcStride[i] > 0; ++i) {
|
||||
// start at block0
|
||||
be.src = 0;
|
||||
be.base_src = &source;
|
||||
be.src_stride = kSrcStride[i];
|
||||
|
||||
// set difference
|
||||
int16_t *src_diff = be.src_diff;
|
||||
for (int r = 0; r < kBlockHeight; ++r) {
|
||||
for (int c = 0; c < kBlockWidth; ++c) {
|
||||
src_diff[c] = 0xa5a5;
|
||||
}
|
||||
src_diff += kDiffPredStride;
|
||||
}
|
||||
|
||||
// set destination
|
||||
uint8_t *base_src = *be.base_src;
|
||||
for (int r = 0; r < kBlockHeight; ++r) {
|
||||
for (int c = 0; c < kBlockWidth; ++c) {
|
||||
base_src[c] = rnd.Rand8();
|
||||
}
|
||||
base_src += be.src_stride;
|
||||
}
|
||||
|
||||
// set predictor
|
||||
uint8_t *predictor = bd.predictor;
|
||||
for (int r = 0; r < kBlockHeight; ++r) {
|
||||
for (int c = 0; c < kBlockWidth; ++c) {
|
||||
predictor[c] = rnd.Rand8();
|
||||
}
|
||||
predictor += kDiffPredStride;
|
||||
}
|
||||
|
||||
REGISTER_STATE_CHECK(GetParam()(&be, &bd, kDiffPredStride));
|
||||
|
||||
base_src = *be.base_src;
|
||||
src_diff = be.src_diff;
|
||||
predictor = bd.predictor;
|
||||
for (int r = 0; r < kBlockHeight; ++r) {
|
||||
for (int c = 0; c < kBlockWidth; ++c) {
|
||||
EXPECT_EQ(base_src[c], (src_diff[c] + predictor[c])) << "r = " << r
|
||||
<< ", c = " << c;
|
||||
}
|
||||
src_diff += kDiffPredStride;
|
||||
predictor += kDiffPredStride;
|
||||
base_src += be.src_stride;
|
||||
}
|
||||
}
|
||||
vpx_free(be.src_diff);
|
||||
vpx_free(source);
|
||||
vpx_free(bd.predictor);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(C, SubtractBlockTest,
|
||||
::testing::Values(vp8_subtract_b_c));
|
||||
|
||||
#if HAVE_MMX
|
||||
INSTANTIATE_TEST_CASE_P(MMX, SubtractBlockTest,
|
||||
::testing::Values(vp8_subtract_b_mmx));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, SubtractBlockTest,
|
||||
::testing::Values(vp8_subtract_b_sse2));
|
||||
#endif
|
||||
|
||||
} // namespace
|
123
test/test-data.sha1
Normal file
123
test/test-data.sha1
Normal file
@@ -0,0 +1,123 @@
|
||||
d5dfb0151c9051f8c85999255645d7a23916d3c0 hantro_collage_w352h288.yuv
|
||||
5184c46ddca8b1fadd16742e8500115bc8f749da vp80-00-comprehensive-001.ivf
|
||||
65bf1bbbced81b97bd030f376d1b7f61a224793f vp80-00-comprehensive-002.ivf
|
||||
906b4c1e99eb734504c504b3f1ad8052137ce672 vp80-00-comprehensive-003.ivf
|
||||
ec144b1af53af895db78355785650b96dd3f0ade vp80-00-comprehensive-004.ivf
|
||||
afc7091785c62f1c121c4554a2830c30704587d9 vp80-00-comprehensive-005.ivf
|
||||
42ea9d55c818145d06a9b633b8e85c6a6164fd3e vp80-00-comprehensive-006.ivf
|
||||
e5b3a73ab79fe024c14309d653d6bed92902ee3b vp80-00-comprehensive-007.ivf
|
||||
f3c50a58875930adfb84525c0ef59d7e4c08540c vp80-00-comprehensive-008.ivf
|
||||
4b2841fdb83db51ae322096ae468bbb9dc2c8362 vp80-00-comprehensive-009.ivf
|
||||
efbff736e3a91ab6a98c5bc2dce65d645944c7b1 vp80-00-comprehensive-010.ivf
|
||||
6b315102cae008d22a3d2c231be92cb704a222f8 vp80-00-comprehensive-011.ivf
|
||||
f3214a4fea14c2d5ec689936c1613f274c859ee8 vp80-00-comprehensive-012.ivf
|
||||
e4094e96d308c8a35b74c480a43d853c5294cd34 vp80-00-comprehensive-013.ivf
|
||||
5b0adfaf60a69e0aaf3ec021a39d0a68fc0e1b5a vp80-00-comprehensive-014.ivf
|
||||
e8467688ddf26b5000664f904faf0d70506aa653 vp80-00-comprehensive-015.ivf
|
||||
aab55582337dfd2a39ff54fb2576a91910d49337 vp80-00-comprehensive-016.ivf
|
||||
1ba24724f80203c9bae4f1d0f99d534721980016 vp80-00-comprehensive-017.ivf
|
||||
143a15512b46f436280ddb4d0e6411eb4af434f2 vp80-00-comprehensive-018.ivf
|
||||
c5baeaf5714fdfb3a8bc960a8e33ac438e83b16b vp80-01-intra-1400.ivf
|
||||
f383955229afe3408453e316d11553d923ca60d5 vp80-01-intra-1411.ivf
|
||||
84e1f4343f174c9f3c83f834bac3196fb325bf2c vp80-01-intra-1416.ivf
|
||||
fb6e712a47dd57a28a3727d2ae2c97a8b7c7ca51 vp80-01-intra-1417.ivf
|
||||
71ea772d3e9d315b8cbecf41207b8a237c34853b vp80-02-inter-1402.ivf
|
||||
d85dbc4271525dcd128c503f936fe69091d1f8d0 vp80-02-inter-1412.ivf
|
||||
d4e5d3ad56511867d025f93724d090f92ba6ec3d vp80-02-inter-1418.ivf
|
||||
91791cbcc37c60f35dbd8090bacb54e5ec6dd4fa vp80-02-inter-1424.ivf
|
||||
17fbfe2fea70f6e2f3fa6ca4efaae6c0b03b5f02 vp80-03-segmentation-01.ivf
|
||||
3c3600dbbcde08e20d54c66fe3b7eadd4f09bdbb vp80-03-segmentation-02.ivf
|
||||
c156778d5340967d4b369c490848076e92f1f875 vp80-03-segmentation-03.ivf
|
||||
d25dcff6c60e87a1af70945b8911b6b4998533b0 vp80-03-segmentation-04.ivf
|
||||
362baba2ce454c9db21218f35e81c27a5ed0b730 vp80-03-segmentation-1401.ivf
|
||||
d223ae7ee748ce07e74c4679bfd219e84aa9f4b0 vp80-03-segmentation-1403.ivf
|
||||
033adf7f3a13836a3f1cffcb87c1972900f2b5c6 vp80-03-segmentation-1407.ivf
|
||||
4d51dfbf9f3e2c590ec99d1d6f59dd731d04375f vp80-03-segmentation-1408.ivf
|
||||
f37a62b197c2600d75e0ccfbb31b60efdedac251 vp80-03-segmentation-1409.ivf
|
||||
eb25bd7bfba5b2f6935018a930f42d123b1e7fcd vp80-03-segmentation-1410.ivf
|
||||
b9d5c436663a30c27cfff84b53a002e501258843 vp80-03-segmentation-1413.ivf
|
||||
6da92b9d1a180cc3a8afe348ab12258f5a37be1a vp80-03-segmentation-1414.ivf
|
||||
a4f5842602886bd669f115f93d8a35c035cb0948 vp80-03-segmentation-1415.ivf
|
||||
f295dceb8ef278b77251b3f9df8aee22e161d547 vp80-03-segmentation-1425.ivf
|
||||
198dbf9f36f733200e432664cc8c5752d59779de vp80-03-segmentation-1426.ivf
|
||||
7704804e32f5de976803929934a7fafe101ac7b0 vp80-03-segmentation-1427.ivf
|
||||
831ccd862ea95ca025d2f3bd8b88678752f5416d vp80-03-segmentation-1432.ivf
|
||||
b3c11978529289f9109f2766fcaba3ebc40e11ef vp80-03-segmentation-1435.ivf
|
||||
a835a731f5520ebfc1002c40121264d0020559ac vp80-03-segmentation-1436.ivf
|
||||
1d1732942f773bb2a5775fcb9689b1579ce28eab vp80-03-segmentation-1437.ivf
|
||||
db04799adfe089dfdf74dbd43cc05ede7161f99e vp80-03-segmentation-1441.ivf
|
||||
7caf39b3f20cfd52b998210878062e52a5edf1e6 vp80-03-segmentation-1442.ivf
|
||||
3607f6bb4ee106c38fa1ea370dc4ff8b8cde2261 vp80-04-partitions-1404.ivf
|
||||
93cc323b6b6867f1b12dd48773424549c6960a6b vp80-04-partitions-1405.ivf
|
||||
047eedb14b865bdac8a3538e63801054e0295e9c vp80-04-partitions-1406.ivf
|
||||
0f1233bd2bc33f56ce5e495dbd455d122339f384 vp80-05-sharpness-1428.ivf
|
||||
51767fc136488a9535c2a4c38067c542ee2048df vp80-05-sharpness-1429.ivf
|
||||
9805aa107672de25d6fb8c35e20d06deca5efe18 vp80-05-sharpness-1430.ivf
|
||||
61db6b965f9c27aebe71b85bf2d5877e58e4bbdf vp80-05-sharpness-1431.ivf
|
||||
10420d266290d2923555f84af38eeb96edbd3ae8 vp80-05-sharpness-1433.ivf
|
||||
3ed24f9a80cddfdf75824ba95cdb4ff9286cb443 vp80-05-sharpness-1434.ivf
|
||||
c87599cbecd72d4cd4f7ace3313b7a6bc6eb8163 vp80-05-sharpness-1438.ivf
|
||||
aff51d865c2621b60510459244ea83e958e4baed vp80-05-sharpness-1439.ivf
|
||||
da386e72b19b5485a6af199c5eb60ef25e510dd1 vp80-05-sharpness-1440.ivf
|
||||
6759a095203d96ccd267ce09b1b050b8cc4c2f1f vp80-05-sharpness-1443.ivf
|
||||
db55ec7fd02c864ba996ff060b25b1e08611330b vp80-00-comprehensive-001.ivf.md5
|
||||
29db0ad011cba1e45f856d5623cd38dac3e3bf19 vp80-00-comprehensive-002.ivf.md5
|
||||
e84f258f69e173e7d68f8f8c037a0a3766902182 vp80-00-comprehensive-003.ivf.md5
|
||||
eb7912eaf69559a16fd82bc3f5fb1524cf4a4466 vp80-00-comprehensive-004.ivf.md5
|
||||
4206f71c94894bd5b5b376f6c09b3817dbc65206 vp80-00-comprehensive-005.ivf.md5
|
||||
4f89b356f6f2fecb928f330a10f804f00f5325f5 vp80-00-comprehensive-006.ivf.md5
|
||||
2813236a32964dd8007e17648bcf035a20fcda6c vp80-00-comprehensive-007.ivf.md5
|
||||
10746c72098f872803c900e17c5680e451f5f498 vp80-00-comprehensive-008.ivf.md5
|
||||
39a23d0692ce64421a7bb7cdf6ccec5928d37fff vp80-00-comprehensive-009.ivf.md5
|
||||
f6e3de8931a0cc659bda8fbc14050346955e72d4 vp80-00-comprehensive-010.ivf.md5
|
||||
101683ec195b6e944f7cd1e468fc8921439363e6 vp80-00-comprehensive-011.ivf.md5
|
||||
1f592751ce46d8688998fa0fa4fbdcda0fd4058c vp80-00-comprehensive-012.ivf.md5
|
||||
6066176f90ca790251e795fca1a5797d59999841 vp80-00-comprehensive-013.ivf.md5
|
||||
2656da94ba93691f23edc4d60b3a09e2be46c217 vp80-00-comprehensive-014.ivf.md5
|
||||
c6e0d5f5d61460c8ac8edfa4e701f10312c03133 vp80-00-comprehensive-015.ivf.md5
|
||||
ee60fee501d8493e34e8d6a1fe315b51ed09b24a vp80-00-comprehensive-016.ivf.md5
|
||||
9f1914ceffcad4546c0a29de3ef591d8bea304dc vp80-00-comprehensive-017.ivf.md5
|
||||
e0305178fe288a9fd8082b39e2d03181edb19054 vp80-00-comprehensive-018.ivf.md5
|
||||
612494da2fa799cc9d76dcdd835ae6c7cb2e5c05 vp80-01-intra-1400.ivf.md5
|
||||
48ea06097ac8269c5e8c2131d3d0639f431fcf0e vp80-01-intra-1411.ivf.md5
|
||||
6e2ab4e7677ad0ba868083ca6bc387ee922b400c vp80-01-intra-1416.ivf.md5
|
||||
eca0a90348959ce3854142f8d8641b13050e8349 vp80-01-intra-1417.ivf.md5
|
||||
920feea203145d5c2258a91c4e6991934a79a99e vp80-02-inter-1402.ivf.md5
|
||||
f71d97909fe2b3dd65be7e1f56c72237f0cef200 vp80-02-inter-1412.ivf.md5
|
||||
e911254569a30bbb2a237ff8b79f69ed9da0672d vp80-02-inter-1418.ivf.md5
|
||||
58c789c50c9bb9cc90580bed291164a0939d28ba vp80-02-inter-1424.ivf.md5
|
||||
ff3e2f441327b9c20a0b37c524e0f5a48a36de7b vp80-03-segmentation-01.ivf.md5
|
||||
0791f417f076a542ae66fbc3426ab4d94cbd6c75 vp80-03-segmentation-02.ivf.md5
|
||||
722e50f1a6a91c34302d68681faffc1c26d1cc57 vp80-03-segmentation-03.ivf.md5
|
||||
c701f1885bcfb27fb8e70cc65606b289172ef889 vp80-03-segmentation-04.ivf.md5
|
||||
f79bc9ec189a2b4807632a3d0c5bf04a178b5300 vp80-03-segmentation-1401.ivf.md5
|
||||
b9aa4c74c0219b639811c44760d0b24cd8bb436a vp80-03-segmentation-1403.ivf.md5
|
||||
70d5a2207ca1891bcaebd5cf6dd88ce8d57b4334 vp80-03-segmentation-1407.ivf.md5
|
||||
265f962ee781531f9a93b9309461316fd32b2a1d vp80-03-segmentation-1408.ivf.md5
|
||||
0c4ecbbd6dc042d30e626d951b65f460dd6cd563 vp80-03-segmentation-1409.ivf.md5
|
||||
cf779af36a937f06570a0fca9db64ba133451dee vp80-03-segmentation-1410.ivf.md5
|
||||
0e6c5036d51ab078842f133934926c598a9cff02 vp80-03-segmentation-1413.ivf.md5
|
||||
eb3930aaf229116c80d507516c34759c3f6cdf69 vp80-03-segmentation-1414.ivf.md5
|
||||
123d6c0f72ee87911c4ae7538e87b7d163b22d6c vp80-03-segmentation-1415.ivf.md5
|
||||
e70551d1a38920e097a5d8782390b79ecaeb7505 vp80-03-segmentation-1425.ivf.md5
|
||||
44e8f4117e46dbb302b2cfd81171cc1a1846e431 vp80-03-segmentation-1426.ivf.md5
|
||||
52636e54aee5f95bbace37021bd67de5db767e9a vp80-03-segmentation-1427.ivf.md5
|
||||
b1ad3eff20215c28e295b15ef3636ed926d59cba vp80-03-segmentation-1432.ivf.md5
|
||||
24c22a552fa28a90e5978f67f57181cc2d7546d7 vp80-03-segmentation-1435.ivf.md5
|
||||
96c49c390abfced18a7a8c9b9ea10af778e10edb vp80-03-segmentation-1436.ivf.md5
|
||||
f95eb6214571434f1f73ab7833b9ccdf47588020 vp80-03-segmentation-1437.ivf.md5
|
||||
1c0700ca27c9b0090a7747a4b0b4dc21d1843181 vp80-03-segmentation-1441.ivf.md5
|
||||
81d4f23ca32667ee958bae579c8f5e97ba72eb97 vp80-03-segmentation-1442.ivf.md5
|
||||
272efcef07a3a30fbca51bfd566063d8258ec0be vp80-04-partitions-1404.ivf.md5
|
||||
66ed219ab812ac801b256d35cf495d193d4cf478 vp80-04-partitions-1405.ivf.md5
|
||||
36083f37f56f502bd60ec5e07502ee9e6b8699b0 vp80-04-partitions-1406.ivf.md5
|
||||
6ca909bf168a64c09415626294665dc1be3d1973 vp80-05-sharpness-1428.ivf.md5
|
||||
1667d2ee2334e5fdea8a8a866f4ccf3cf76f033a vp80-05-sharpness-1429.ivf.md5
|
||||
71bcbe5357d36a19df5b07fbe3e27bffa8893f0a vp80-05-sharpness-1430.ivf.md5
|
||||
89a09b1dffce2d55770a89e58d9925c70ef79bf8 vp80-05-sharpness-1431.ivf.md5
|
||||
08444a18b4e6ba3450c0796dd728d48c399a2dc9 vp80-05-sharpness-1433.ivf.md5
|
||||
6d6223719a90c13e848aa2a8a6642098cdb5977a vp80-05-sharpness-1434.ivf.md5
|
||||
41d70bb5fa45bc88da1604a0af466930b8dd77b5 vp80-05-sharpness-1438.ivf.md5
|
||||
086c56378df81b6cee264d7540a7b8f2b405c7a4 vp80-05-sharpness-1439.ivf.md5
|
||||
d32dc2c4165eb266ea4c23c14a45459b363def32 vp80-05-sharpness-1440.ivf.md5
|
||||
8c69dc3d8e563f56ffab5ad1e400d9e689dd23df vp80-05-sharpness-1443.ivf.md5
|
179
test/test.mk
Normal file
179
test/test.mk
Normal file
@@ -0,0 +1,179 @@
|
||||
LIBVPX_TEST_SRCS-yes += acm_random.h
|
||||
LIBVPX_TEST_SRCS-yes += register_state_check.h
|
||||
LIBVPX_TEST_SRCS-yes += test.mk
|
||||
LIBVPX_TEST_SRCS-yes += test_libvpx.cc
|
||||
LIBVPX_TEST_SRCS-yes += util.h
|
||||
LIBVPX_TEST_SRCS-yes += video_source.h
|
||||
|
||||
##
|
||||
## BLACK BOX TESTS
|
||||
##
|
||||
## Black box tests only use the public API.
|
||||
##
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += altref_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += cq_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += datarate_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += encode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += encode_test_driver.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += error_resilience_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += i420_video_source.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += resize_test.cc
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += ../md5_utils.h ../md5_utils.c
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += decode_test_driver.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += decode_test_driver.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += ivf_video_source.h
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_DECODER) += test_vector_test.cc
|
||||
##
|
||||
## WHITE BOX TESTS
|
||||
##
|
||||
## Whitebox tests invoke functions not exposed via the public API. Certain
|
||||
## shared library builds don't make these functions accessible.
|
||||
##
|
||||
ifeq ($(CONFIG_SHARED),)
|
||||
|
||||
# These tests require both the encoder and decoder to be built.
|
||||
ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),yesyes)
|
||||
LIBVPX_TEST_SRCS-yes += boolcoder_test.cc
|
||||
endif
|
||||
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += fdct4x4_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += idctllm_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += intrapred_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC) += pp_filter_test.cc
|
||||
LIBVPX_TEST_SRCS-yes += sad_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += set_roi.cc
|
||||
LIBVPX_TEST_SRCS-yes += sixtap_predict_test.cc
|
||||
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += subtract_test.cc
|
||||
|
||||
endif
|
||||
|
||||
|
||||
##
|
||||
## TEST DATA
|
||||
##
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_ENCODER) += hantro_collage_w352h288.yuv
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-004.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-005.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-006.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-007.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-008.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-009.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-010.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-011.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-012.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-013.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-014.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-015.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-016.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-017.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-018.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1400.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1411.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1416.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1417.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1402.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1412.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1418.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1424.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-01.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-02.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-03.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-04.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1401.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1403.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1407.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1408.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1409.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1410.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1413.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1414.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1415.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1425.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1426.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1427.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1432.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1435.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1436.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1437.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1441.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1442.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1404.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1405.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1406.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1428.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1429.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1430.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1431.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1433.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1434.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1438.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1439.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1440.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1443.ivf
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-001.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-002.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-003.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-004.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-005.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-006.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-007.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-008.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-009.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-010.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-011.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-012.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-013.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-014.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-015.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-016.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-017.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-00-comprehensive-018.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1400.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1411.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1416.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-01-intra-1417.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1402.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1412.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1418.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-02-inter-1424.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1401.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1403.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1407.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1408.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1409.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1410.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1413.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1414.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1415.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1425.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1426.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1427.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1432.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1435.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1436.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1437.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1441.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-1442.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-01.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-02.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-03.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-03-segmentation-04.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1404.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1405.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-04-partitions-1406.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1428.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1429.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1430.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1431.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1433.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1434.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1438.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1439.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1440.ivf.md5
|
||||
LIBVPX_TEST_DATA-$(CONFIG_VP8_DECODER) += vp80-05-sharpness-1443.ivf.md5
|
45
test/test_libvpx.cc
Normal file
45
test/test_libvpx.cc
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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 <string>
|
||||
#include "vpx_config.h"
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
extern "C" {
|
||||
#include "vpx_ports/x86.h"
|
||||
}
|
||||
#endif
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
|
||||
static void append_gtest_filter(const char *str) {
|
||||
std::string filter = ::testing::FLAGS_gtest_filter;
|
||||
filter += str;
|
||||
::testing::FLAGS_gtest_filter = filter;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
const int simd_caps = x86_simd_caps();
|
||||
if(!(simd_caps & HAS_MMX))
|
||||
append_gtest_filter(":-MMX/*");
|
||||
if(!(simd_caps & HAS_SSE))
|
||||
append_gtest_filter(":-SSE/*");
|
||||
if(!(simd_caps & HAS_SSE2))
|
||||
append_gtest_filter(":-SSE2/*");
|
||||
if(!(simd_caps & HAS_SSE3))
|
||||
append_gtest_filter(":-SSE3/*");
|
||||
if(!(simd_caps & HAS_SSSE3))
|
||||
append_gtest_filter(":-SSSE3/*");
|
||||
if(!(simd_caps & HAS_SSE4_1))
|
||||
append_gtest_filter(":-SSE4_1/*");
|
||||
#endif
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
144
test/test_vector_test.cc
Normal file
144
test/test_vector_test.cc
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
Copyright (c) 2012 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 <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include "third_party/googletest/src/include/gtest/gtest.h"
|
||||
#include "test/decode_test_driver.h"
|
||||
#include "test/ivf_video_source.h"
|
||||
extern "C" {
|
||||
#include "./md5_utils.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
// There are 61 test vectors in total.
|
||||
const char *kTestVectors[] = {
|
||||
"vp80-00-comprehensive-001.ivf",
|
||||
"vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf",
|
||||
"vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf",
|
||||
"vp80-00-comprehensive-006.ivf", "vp80-00-comprehensive-007.ivf",
|
||||
"vp80-00-comprehensive-008.ivf", "vp80-00-comprehensive-009.ivf",
|
||||
"vp80-00-comprehensive-010.ivf", "vp80-00-comprehensive-011.ivf",
|
||||
"vp80-00-comprehensive-012.ivf", "vp80-00-comprehensive-013.ivf",
|
||||
"vp80-00-comprehensive-014.ivf", "vp80-00-comprehensive-015.ivf",
|
||||
"vp80-00-comprehensive-016.ivf", "vp80-00-comprehensive-017.ivf",
|
||||
"vp80-00-comprehensive-018.ivf", "vp80-01-intra-1400.ivf",
|
||||
"vp80-01-intra-1411.ivf", "vp80-01-intra-1416.ivf",
|
||||
"vp80-01-intra-1417.ivf", "vp80-02-inter-1402.ivf",
|
||||
"vp80-02-inter-1412.ivf", "vp80-02-inter-1418.ivf",
|
||||
"vp80-02-inter-1424.ivf", "vp80-03-segmentation-01.ivf",
|
||||
"vp80-03-segmentation-02.ivf", "vp80-03-segmentation-03.ivf",
|
||||
"vp80-03-segmentation-04.ivf", "vp80-03-segmentation-1401.ivf",
|
||||
"vp80-03-segmentation-1403.ivf", "vp80-03-segmentation-1407.ivf",
|
||||
"vp80-03-segmentation-1408.ivf", "vp80-03-segmentation-1409.ivf",
|
||||
"vp80-03-segmentation-1410.ivf", "vp80-03-segmentation-1413.ivf",
|
||||
"vp80-03-segmentation-1414.ivf", "vp80-03-segmentation-1415.ivf",
|
||||
"vp80-03-segmentation-1425.ivf", "vp80-03-segmentation-1426.ivf",
|
||||
"vp80-03-segmentation-1427.ivf", "vp80-03-segmentation-1432.ivf",
|
||||
"vp80-03-segmentation-1435.ivf", "vp80-03-segmentation-1436.ivf",
|
||||
"vp80-03-segmentation-1437.ivf", "vp80-03-segmentation-1441.ivf",
|
||||
"vp80-03-segmentation-1442.ivf", "vp80-04-partitions-1404.ivf",
|
||||
"vp80-04-partitions-1405.ivf", "vp80-04-partitions-1406.ivf",
|
||||
"vp80-05-sharpness-1428.ivf", "vp80-05-sharpness-1429.ivf",
|
||||
"vp80-05-sharpness-1430.ivf", "vp80-05-sharpness-1431.ivf",
|
||||
"vp80-05-sharpness-1433.ivf", "vp80-05-sharpness-1434.ivf",
|
||||
"vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf",
|
||||
"vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf"
|
||||
};
|
||||
|
||||
class TestVectorTest : public libvpx_test::DecoderTest,
|
||||
public ::testing::TestWithParam<const char*> {
|
||||
protected:
|
||||
TestVectorTest() : md5_file_(NULL) {}
|
||||
|
||||
virtual ~TestVectorTest() {
|
||||
if (md5_file_)
|
||||
fclose(md5_file_);
|
||||
}
|
||||
|
||||
void OpenMD5File(const std::string& md5_file_name_) {
|
||||
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
|
||||
ASSERT_TRUE(md5_file_) << "Md5 file open failed. Filename: "
|
||||
<< md5_file_name_;
|
||||
}
|
||||
|
||||
virtual void DecompressedFrameHook(const vpx_image_t& img,
|
||||
const unsigned int frame_number) {
|
||||
char expected_md5[33];
|
||||
char junk[128];
|
||||
|
||||
// Read correct md5 checksums.
|
||||
const int res = fscanf(md5_file_, "%s %s", expected_md5, junk);
|
||||
ASSERT_NE(res, EOF) << "Read md5 data failed";
|
||||
expected_md5[32] = '\0';
|
||||
|
||||
MD5Context md5;
|
||||
MD5Init(&md5);
|
||||
|
||||
// Compute and update md5 for each raw in decompressed data.
|
||||
for (int plane = 0; plane < 3; ++plane) {
|
||||
uint8_t *buf = img.planes[plane];
|
||||
|
||||
for (unsigned int y = 0; y < (plane ? (img.d_h + 1) >> 1 : img.d_h);
|
||||
++y) {
|
||||
MD5Update(&md5, buf, (plane ? (img.d_w + 1) >> 1 : img.d_w));
|
||||
buf += img.stride[plane];
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t md5_sum[16];
|
||||
MD5Final(md5_sum, &md5);
|
||||
|
||||
char actual_md5[33];
|
||||
// Convert to get the actual md5.
|
||||
for (int i = 0; i < 16; i++) {
|
||||
snprintf(&actual_md5[i * 2], sizeof(actual_md5) - i * 2, "%02x",
|
||||
md5_sum[i]);
|
||||
}
|
||||
actual_md5[32] = '\0';
|
||||
|
||||
// Check md5 match.
|
||||
ASSERT_STREQ(expected_md5, actual_md5)
|
||||
<< "Md5 checksums don't match: frame number = " << frame_number;
|
||||
}
|
||||
|
||||
private:
|
||||
FILE *md5_file_;
|
||||
};
|
||||
|
||||
// This test runs through the whole set of test vectors, and decodes them.
|
||||
// The md5 checksums are computed for each frame in the video file. If md5
|
||||
// checksums match the correct md5 data, then the test is passed. Otherwise,
|
||||
// the test failed.
|
||||
TEST_P(TestVectorTest, MD5Match) {
|
||||
const std::string filename = GetParam();
|
||||
// Open compressed video file.
|
||||
libvpx_test::IVFVideoSource video(filename);
|
||||
|
||||
video.Init();
|
||||
|
||||
// Construct md5 file name.
|
||||
const std::string md5_filename = filename + ".md5";
|
||||
OpenMD5File(md5_filename);
|
||||
|
||||
// Decode frame, and check the md5 matching.
|
||||
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(TestVectorSequence, TestVectorTest,
|
||||
::testing::ValuesIn(kTestVectors));
|
||||
|
||||
} // namespace
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 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
|
||||
@@ -8,10 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef TEST_UTIL_H_
|
||||
#define TEST_UTIL_H_
|
||||
|
||||
#ifndef __INC_RECONINTRA_H
|
||||
#define __INC_RECONINTRA_H
|
||||
// Macros
|
||||
#define PARAMS(...) ::testing::TestWithParam< std::tr1::tuple< __VA_ARGS__ > >
|
||||
#define GET_PARAM(k) std::tr1::get< k >(GetParam())
|
||||
|
||||
extern void init_intra_left_above_pixels(MACROBLOCKD *x);
|
||||
|
||||
#endif
|
||||
#endif // TEST_UTIL_H_
|
175
test/video_source.h
Normal file
175
test/video_source.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
#ifndef TEST_VIDEO_SOURCE_H_
|
||||
#define TEST_VIDEO_SOURCE_H_
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include "test/acm_random.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
static FILE *OpenTestDataFile(const std::string& file_name) {
|
||||
std::string path_to_source = file_name;
|
||||
const char *kDataPath = getenv("LIBVPX_TEST_DATA_PATH");
|
||||
|
||||
if (kDataPath) {
|
||||
path_to_source = kDataPath;
|
||||
path_to_source += "/";
|
||||
path_to_source += file_name;
|
||||
}
|
||||
|
||||
return fopen(path_to_source.c_str(), "rb");
|
||||
}
|
||||
|
||||
// Abstract base class for test video sources, which provide a stream of
|
||||
// vpx_image_t images with associated timestamps and duration.
|
||||
class VideoSource {
|
||||
public:
|
||||
virtual ~VideoSource() {}
|
||||
|
||||
// Prepare the stream for reading, rewind/open as necessary.
|
||||
virtual void Begin() = 0;
|
||||
|
||||
// Advance the cursor to the next frame
|
||||
virtual void Next() = 0;
|
||||
|
||||
// Get the current video frame, or NULL on End-Of-Stream.
|
||||
virtual vpx_image_t *img() const = 0;
|
||||
|
||||
// Get the presentation timestamp of the current frame.
|
||||
virtual vpx_codec_pts_t pts() const = 0;
|
||||
|
||||
// Get the current frame's duration
|
||||
virtual unsigned long duration() const = 0;
|
||||
|
||||
// Get the timebase for the stream
|
||||
virtual vpx_rational_t timebase() const = 0;
|
||||
|
||||
// Get the current frame counter, starting at 0.
|
||||
virtual unsigned int frame() const = 0;
|
||||
|
||||
// Get the current file limit.
|
||||
virtual unsigned int limit() const = 0;
|
||||
};
|
||||
|
||||
|
||||
class DummyVideoSource : public VideoSource {
|
||||
public:
|
||||
DummyVideoSource() : img_(NULL), limit_(100), width_(0), height_(0) {
|
||||
SetSize(80, 64);
|
||||
}
|
||||
|
||||
virtual ~DummyVideoSource() { vpx_img_free(img_); }
|
||||
|
||||
virtual void Begin() {
|
||||
frame_ = 0;
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual void Next() {
|
||||
++frame_;
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
virtual vpx_image_t *img() const {
|
||||
return (frame_ < limit_) ? img_ : NULL;
|
||||
}
|
||||
|
||||
// Models a stream where Timebase = 1/FPS, so pts == frame.
|
||||
virtual vpx_codec_pts_t pts() const { return frame_; }
|
||||
|
||||
virtual unsigned long duration() const { return 1; }
|
||||
|
||||
virtual vpx_rational_t timebase() const {
|
||||
const vpx_rational_t t = {1, 30};
|
||||
return t;
|
||||
}
|
||||
|
||||
virtual unsigned int frame() const { return frame_; }
|
||||
|
||||
virtual unsigned int limit() const { return limit_; }
|
||||
|
||||
void SetSize(unsigned int width, unsigned int height) {
|
||||
if (width != width_ || height != height_) {
|
||||
vpx_img_free(img_);
|
||||
raw_sz_ = ((width + 31)&~31) * height * 3 / 2;
|
||||
img_ = vpx_img_alloc(NULL, VPX_IMG_FMT_VPXI420, width, height, 32);
|
||||
width_ = width;
|
||||
height_ = height;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void FillFrame() { memset(img_->img_data, 0, raw_sz_); }
|
||||
|
||||
vpx_image_t *img_;
|
||||
size_t raw_sz_;
|
||||
unsigned int limit_;
|
||||
unsigned int frame_;
|
||||
unsigned int width_;
|
||||
unsigned int height_;
|
||||
};
|
||||
|
||||
|
||||
class RandomVideoSource : public DummyVideoSource {
|
||||
public:
|
||||
RandomVideoSource(int seed = ACMRandom::DeterministicSeed())
|
||||
: rnd_(seed),
|
||||
seed_(seed) { }
|
||||
|
||||
protected:
|
||||
// Reset the RNG to get a matching stream for the second pass
|
||||
virtual void Begin() {
|
||||
frame_ = 0;
|
||||
rnd_.Reset(seed_);
|
||||
FillFrame();
|
||||
}
|
||||
|
||||
// 15 frames of noise, followed by 15 static frames. Reset to 0 rather
|
||||
// than holding previous frames to encourage keyframes to be thrown.
|
||||
virtual void FillFrame() {
|
||||
if (frame_ % 30 < 15)
|
||||
for (size_t i = 0; i < raw_sz_; ++i)
|
||||
img_->img_data[i] = rnd_.Rand8();
|
||||
else
|
||||
memset(img_->img_data, 0, raw_sz_);
|
||||
}
|
||||
|
||||
ACMRandom rnd_;
|
||||
int seed_;
|
||||
};
|
||||
|
||||
// Abstract base class for test video sources, which provide a stream of
|
||||
// decompressed images to the decoder.
|
||||
class CompressedVideoSource {
|
||||
public:
|
||||
virtual ~CompressedVideoSource() {}
|
||||
|
||||
virtual void Init() = 0;
|
||||
|
||||
// Prepare the stream for reading, rewind/open as necessary.
|
||||
virtual void Begin() = 0;
|
||||
|
||||
// Advance the cursor to the next frame
|
||||
virtual void Next() = 0;
|
||||
|
||||
virtual const uint8_t *cxdata() const = 0;
|
||||
|
||||
virtual const unsigned int frame_size() const = 0;
|
||||
|
||||
virtual const unsigned int frame_number() const = 0;
|
||||
};
|
||||
|
||||
} // namespace libvpx_test
|
||||
|
||||
#endif // TEST_VIDEO_SOURCE_H_
|
8
third_party/libyuv/source/scale.c
vendored
8
third_party/libyuv/source/scale.c
vendored
@@ -60,7 +60,7 @@ void SetUseReferenceImpl(int use) {
|
||||
|
||||
#if defined(__ARM_NEON__) && !defined(YUV_DISABLE_ASM)
|
||||
#define HAS_SCALEROWDOWN2_NEON
|
||||
void ScaleRowDown2_NEON(const uint8* src_ptr, int /* src_stride */,
|
||||
void ScaleRowDown2_NEON(const uint8* src_ptr, int src_stride,
|
||||
uint8* dst, int dst_width) {
|
||||
asm volatile (
|
||||
"1: \n"
|
||||
@@ -102,7 +102,7 @@ void ScaleRowDown2Int_NEON(const uint8* src_ptr, int src_stride,
|
||||
}
|
||||
|
||||
#define HAS_SCALEROWDOWN4_NEON
|
||||
static void ScaleRowDown4_NEON(const uint8* src_ptr, int /* src_stride */,
|
||||
static void ScaleRowDown4_NEON(const uint8* src_ptr, int src_stride,
|
||||
uint8* dst_ptr, int dst_width) {
|
||||
asm volatile (
|
||||
"1: \n"
|
||||
@@ -160,7 +160,7 @@ static void ScaleRowDown4Int_NEON(const uint8* src_ptr, int src_stride,
|
||||
// Down scale from 4 to 3 pixels. Use the neon multilane read/write
|
||||
// to load up the every 4th pixel into a 4 different registers.
|
||||
// Point samples 32 pixels to 24 pixels.
|
||||
static void ScaleRowDown34_NEON(const uint8* src_ptr, int /* src_stride */,
|
||||
static void ScaleRowDown34_NEON(const uint8* src_ptr, int src_stride,
|
||||
uint8* dst_ptr, int dst_width) {
|
||||
asm volatile (
|
||||
"1: \n"
|
||||
@@ -284,7 +284,7 @@ const unsigned short mult38_div9[8] __attribute__ ((aligned(16))) =
|
||||
65536 / 18, 65536 / 18, 65536 / 18, 65536 / 18 };
|
||||
|
||||
// 32 -> 12
|
||||
static void ScaleRowDown38_NEON(const uint8* src_ptr, int,
|
||||
static void ScaleRowDown38_NEON(const uint8* src_ptr, int src_stride,
|
||||
uint8* dst_ptr, int dst_width) {
|
||||
asm volatile (
|
||||
"vld1.u8 {q3}, [%3] \n"
|
||||
|
160
tools/ftfy.sh
Executable file
160
tools/ftfy.sh
Executable file
@@ -0,0 +1,160 @@
|
||||
#!/bin/sh
|
||||
self="$0"
|
||||
dirname_self=$(dirname "$self")
|
||||
|
||||
usage() {
|
||||
cat <<EOF >&2
|
||||
Usage: $self [option]
|
||||
|
||||
This script applies a whitespace transformation to the commit at HEAD. If no
|
||||
options are given, then the modified files are left in the working tree.
|
||||
|
||||
Options:
|
||||
-h, --help Shows this message
|
||||
-n, --dry-run Shows a diff of the changes to be made.
|
||||
--amend Squashes the changes into the commit at HEAD
|
||||
This option will also reformat the commit message.
|
||||
--commit Creates a new commit containing only the whitespace changes
|
||||
--msg-only Reformat the commit message only, ignore the patch itself.
|
||||
|
||||
EOF
|
||||
rm -f ${CLEAN_FILES}
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
log() {
|
||||
echo "${self##*/}: $@" >&2
|
||||
}
|
||||
|
||||
|
||||
vpx_style() {
|
||||
astyle --style=bsd --min-conditional-indent=0 --break-blocks \
|
||||
--pad-oper --pad-header --unpad-paren \
|
||||
--align-pointer=name \
|
||||
--indent-preprocessor --convert-tabs --indent-labels \
|
||||
--suffix=none --quiet "$@"
|
||||
sed -i "" 's/[[:space:]]\{1,\},/,/g' "$@"
|
||||
}
|
||||
|
||||
|
||||
apply() {
|
||||
[ $INTERSECT_RESULT -ne 0 ] && patch -p1 < "$1"
|
||||
}
|
||||
|
||||
|
||||
commit() {
|
||||
LAST_CHANGEID=$(git show | awk '/Change-Id:/{print $2}')
|
||||
if [ -z "$LAST_CHANGEID" ]; then
|
||||
log "HEAD doesn't have a Change-Id, unable to generate a new commit"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build a deterministic Change-Id from the parent's
|
||||
NEW_CHANGEID=${LAST_CHANGEID}-styled
|
||||
NEW_CHANGEID=I$(echo $NEW_CHANGEID | git hash-object --stdin)
|
||||
|
||||
# Commit, preserving authorship from the parent commit.
|
||||
git commit -a -C HEAD > /dev/null
|
||||
git commit --amend -F- << EOF
|
||||
Cosmetic: Fix whitespace in change ${LAST_CHANGEID:0:9}
|
||||
|
||||
Change-Id: ${NEW_CHANGEID}
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
show_commit_msg_diff() {
|
||||
if [ $DIFF_MSG_RESULT -ne 0 ]; then
|
||||
log "Modified commit message:"
|
||||
diff -u "$ORIG_COMMIT_MSG" "$NEW_COMMIT_MSG" | tail -n +3
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
amend() {
|
||||
show_commit_msg_diff
|
||||
if [ $DIFF_MSG_RESULT -ne 0 ] || [ $INTERSECT_RESULT -ne 0 ]; then
|
||||
git commit -a --amend -F "$NEW_COMMIT_MSG"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
diff_msg() {
|
||||
git log -1 --format=%B > "$ORIG_COMMIT_MSG"
|
||||
"${dirname_self}"/wrap-commit-msg.py \
|
||||
< "$ORIG_COMMIT_MSG" > "$NEW_COMMIT_MSG"
|
||||
cmp -s "$ORIG_COMMIT_MSG" "$NEW_COMMIT_MSG"
|
||||
DIFF_MSG_RESULT=$?
|
||||
}
|
||||
|
||||
|
||||
# Temporary files
|
||||
ORIG_DIFF=orig.diff.$$
|
||||
MODIFIED_DIFF=modified.diff.$$
|
||||
FINAL_DIFF=final.diff.$$
|
||||
ORIG_COMMIT_MSG=orig.commit-msg.$$
|
||||
NEW_COMMIT_MSG=new.commit-msg.$$
|
||||
CLEAN_FILES="${ORIG_DIFF} ${MODIFIED_DIFF} ${FINAL_DIFF}"
|
||||
CLEAN_FILES="${CLEAN_FILES} ${ORIG_COMMIT_MSG} ${NEW_COMMIT_MSG}"
|
||||
|
||||
# Preconditions
|
||||
[ $# -lt 2 ] || usage
|
||||
|
||||
# Check that astyle supports pad-header and align-pointer=name
|
||||
if ! astyle --pad-header --align-pointer=name < /dev/null; then
|
||||
log "Install astyle v1.24 or newer"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! git diff --quiet HEAD; then
|
||||
log "Working tree is dirty, commit your changes first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Need to be in the root
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
# Collect the original diff
|
||||
git show > "${ORIG_DIFF}"
|
||||
|
||||
# Apply the style guide on new and modified files and collect its diff
|
||||
for f in $(git diff HEAD^ --name-only -M90 --diff-filter=AM \
|
||||
| grep '\.[ch]$'); do
|
||||
case "$f" in
|
||||
third_party/*) continue;;
|
||||
nestegg/*) continue;;
|
||||
esac
|
||||
vpx_style "$f"
|
||||
done
|
||||
git diff --no-color --no-ext-diff > "${MODIFIED_DIFF}"
|
||||
|
||||
# Intersect the two diffs
|
||||
"${dirname_self}"/intersect-diffs.py \
|
||||
"${ORIG_DIFF}" "${MODIFIED_DIFF}" > "${FINAL_DIFF}"
|
||||
INTERSECT_RESULT=$?
|
||||
git reset --hard >/dev/null
|
||||
|
||||
# Fixup the commit message
|
||||
diff_msg
|
||||
|
||||
# Handle options
|
||||
if [ -n "$1" ]; then
|
||||
case "$1" in
|
||||
-h|--help) usage;;
|
||||
-n|--dry-run) cat "${FINAL_DIFF}"; show_commit_msg_diff;;
|
||||
--commit) apply "${FINAL_DIFF}"; commit;;
|
||||
--amend) apply "${FINAL_DIFF}"; amend;;
|
||||
--msg-only) amend;;
|
||||
*) usage;;
|
||||
esac
|
||||
else
|
||||
apply "${FINAL_DIFF}"
|
||||
if ! git diff --quiet; then
|
||||
log "Formatting changes applied, verify and commit."
|
||||
log "See also: http://www.webmproject.org/code/contribute/conventions/"
|
||||
git diff --stat
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f ${CLEAN_FILES}
|
188
tools/intersect-diffs.py
Executable file
188
tools/intersect-diffs.py
Executable file
@@ -0,0 +1,188 @@
|
||||
#!/usr/bin/env python
|
||||
## Copyright (c) 2012 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.
|
||||
##
|
||||
"""Calculates the "intersection" of two unified diffs.
|
||||
|
||||
Given two diffs, A and B, it finds all hunks in B that had non-context lines
|
||||
in A and prints them to stdout. This is useful to determine the hunks in B that
|
||||
are relevant to A. The resulting file can be applied with patch(1) on top of A.
|
||||
"""
|
||||
|
||||
__author__ = "jkoleszar@google.com"
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
class DiffLines(object):
|
||||
"""A container for one half of a diff."""
|
||||
|
||||
def __init__(self, filename, offset, length):
|
||||
self.filename = filename
|
||||
self.offset = offset
|
||||
self.length = length
|
||||
self.lines = []
|
||||
self.delta_line_nums = []
|
||||
|
||||
def Append(self, line):
|
||||
l = len(self.lines)
|
||||
if line[0] != " ":
|
||||
self.delta_line_nums.append(self.offset + l)
|
||||
self.lines.append(line[1:])
|
||||
assert l+1 <= self.length
|
||||
|
||||
def Complete(self):
|
||||
return len(self.lines) == self.length
|
||||
|
||||
def __contains__(self, item):
|
||||
return item >= self.offset and item <= self.offset + self.length - 1
|
||||
|
||||
|
||||
class DiffHunk(object):
|
||||
"""A container for one diff hunk, consisting of two DiffLines."""
|
||||
|
||||
def __init__(self, header, file_a, file_b, start_a, len_a, start_b, len_b):
|
||||
self.header = header
|
||||
self.left = DiffLines(file_a, start_a, len_a)
|
||||
self.right = DiffLines(file_b, start_b, len_b)
|
||||
self.lines = []
|
||||
|
||||
def Append(self, line):
|
||||
"""Adds a line to the DiffHunk and its DiffLines children."""
|
||||
if line[0] == "-":
|
||||
self.left.Append(line)
|
||||
elif line[0] == "+":
|
||||
self.right.Append(line)
|
||||
elif line[0] == " ":
|
||||
self.left.Append(line)
|
||||
self.right.Append(line)
|
||||
else:
|
||||
assert False, ("Unrecognized character at start of diff line "
|
||||
"%r" % line[0])
|
||||
self.lines.append(line)
|
||||
|
||||
def Complete(self):
|
||||
return self.left.Complete() and self.right.Complete()
|
||||
|
||||
def __repr__(self):
|
||||
return "DiffHunk(%s, %s, len %d)" % (
|
||||
self.left.filename, self.right.filename,
|
||||
max(self.left.length, self.right.length))
|
||||
|
||||
|
||||
def ParseDiffHunks(stream):
|
||||
"""Walk a file-like object, yielding DiffHunks as they're parsed."""
|
||||
|
||||
file_regex = re.compile(r"(\+\+\+|---) (\S+)")
|
||||
range_regex = re.compile(r"@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?")
|
||||
hunk = None
|
||||
while True:
|
||||
line = stream.readline()
|
||||
if not line:
|
||||
break
|
||||
|
||||
if hunk is None:
|
||||
# Parse file names
|
||||
diff_file = file_regex.match(line)
|
||||
if diff_file:
|
||||
if line.startswith("---"):
|
||||
a_line = line
|
||||
a = diff_file.group(2)
|
||||
continue
|
||||
if line.startswith("+++"):
|
||||
b_line = line
|
||||
b = diff_file.group(2)
|
||||
continue
|
||||
|
||||
# Parse offset/lengths
|
||||
diffrange = range_regex.match(line)
|
||||
if diffrange:
|
||||
if diffrange.group(2):
|
||||
start_a = int(diffrange.group(1))
|
||||
len_a = int(diffrange.group(3))
|
||||
else:
|
||||
start_a = 1
|
||||
len_a = int(diffrange.group(1))
|
||||
|
||||
if diffrange.group(5):
|
||||
start_b = int(diffrange.group(4))
|
||||
len_b = int(diffrange.group(6))
|
||||
else:
|
||||
start_b = 1
|
||||
len_b = int(diffrange.group(4))
|
||||
|
||||
header = [a_line, b_line, line]
|
||||
hunk = DiffHunk(header, a, b, start_a, len_a, start_b, len_b)
|
||||
else:
|
||||
# Add the current line to the hunk
|
||||
hunk.Append(line)
|
||||
|
||||
# See if the whole hunk has been parsed. If so, yield it and prepare
|
||||
# for the next hunk.
|
||||
if hunk.Complete():
|
||||
yield hunk
|
||||
hunk = None
|
||||
|
||||
# Partial hunks are a parse error
|
||||
assert hunk is None
|
||||
|
||||
|
||||
def FormatDiffHunks(hunks):
|
||||
"""Re-serialize a list of DiffHunks."""
|
||||
r = []
|
||||
last_header = None
|
||||
for hunk in hunks:
|
||||
this_header = hunk.header[0:2]
|
||||
if last_header != this_header:
|
||||
r.extend(hunk.header)
|
||||
last_header = this_header
|
||||
else:
|
||||
r.extend(hunk.header[2])
|
||||
r.extend(hunk.lines)
|
||||
r.append("\n")
|
||||
return "".join(r)
|
||||
|
||||
|
||||
def ZipHunks(rhs_hunks, lhs_hunks):
|
||||
"""Join two hunk lists on filename."""
|
||||
for rhs_hunk in rhs_hunks:
|
||||
rhs_file = rhs_hunk.right.filename.split("/")[1:]
|
||||
|
||||
for lhs_hunk in lhs_hunks:
|
||||
lhs_file = lhs_hunk.left.filename.split("/")[1:]
|
||||
if lhs_file != rhs_file:
|
||||
continue
|
||||
yield (rhs_hunk, lhs_hunk)
|
||||
|
||||
|
||||
def main():
|
||||
old_hunks = [x for x in ParseDiffHunks(open(sys.argv[1], "r"))]
|
||||
new_hunks = [x for x in ParseDiffHunks(open(sys.argv[2], "r"))]
|
||||
out_hunks = []
|
||||
|
||||
# Join the right hand side of the older diff with the left hand side of the
|
||||
# newer diff.
|
||||
for old_hunk, new_hunk in ZipHunks(old_hunks, new_hunks):
|
||||
if new_hunk in out_hunks:
|
||||
continue
|
||||
old_lines = old_hunk.right
|
||||
new_lines = new_hunk.left
|
||||
|
||||
# Determine if this hunk overlaps any non-context line from the other
|
||||
for i in old_lines.delta_line_nums:
|
||||
if i in new_lines:
|
||||
out_hunks.append(new_hunk)
|
||||
break
|
||||
|
||||
if out_hunks:
|
||||
print FormatDiffHunks(out_hunks)
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
70
tools/wrap-commit-msg.py
Executable file
70
tools/wrap-commit-msg.py
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python
|
||||
## Copyright (c) 2012 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.
|
||||
##
|
||||
"""Wraps paragraphs of text, preserving manual formatting
|
||||
|
||||
This is like fold(1), but has the special convention of not modifying lines
|
||||
that start with whitespace. This allows you to intersperse blocks with
|
||||
special formatting, like code blocks, with written prose. The prose will
|
||||
be wordwrapped, and the manual formatting will be preserved.
|
||||
|
||||
* This won't handle the case of a bulleted (or ordered) list specially, so
|
||||
manual wrapping must be done.
|
||||
|
||||
Occasionally it's useful to put something with explicit formatting that
|
||||
doesn't look at all like a block of text inline.
|
||||
|
||||
indicator = has_leading_whitespace(line);
|
||||
if (indicator)
|
||||
preserve_formatting(line);
|
||||
|
||||
The intent is that this docstring would make it through the transform
|
||||
and still be legible and presented as it is in the source. If additional
|
||||
cases are handled, update this doc to describe the effect.
|
||||
"""
|
||||
|
||||
__author__ = "jkoleszar@google.com"
|
||||
import textwrap
|
||||
import sys
|
||||
|
||||
def wrap(text):
|
||||
if text:
|
||||
return textwrap.fill(text, break_long_words=False) + '\n'
|
||||
return ""
|
||||
|
||||
|
||||
def main(fileobj):
|
||||
text = ""
|
||||
output = ""
|
||||
while True:
|
||||
line = fileobj.readline()
|
||||
if not line:
|
||||
break
|
||||
|
||||
if line.lstrip() == line:
|
||||
text += line
|
||||
else:
|
||||
output += wrap(text)
|
||||
text=""
|
||||
output += line
|
||||
output += wrap(text)
|
||||
|
||||
# Replace the file or write to stdout.
|
||||
if fileobj == sys.stdin:
|
||||
fileobj = sys.stdout
|
||||
else:
|
||||
fileobj.seek(0)
|
||||
fileobj.truncate(0)
|
||||
fileobj.write(output)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
main(open(sys.argv[1], "r+"))
|
||||
else:
|
||||
main(sys.stdin)
|
@@ -9,15 +9,21 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "tools_common.h"
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(__OS2__)
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef __OS2__
|
||||
#define _setmode setmode
|
||||
#define _fileno fileno
|
||||
#define _O_BINARY O_BINARY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FILE* set_binary_mode(FILE *stream)
|
||||
{
|
||||
(void)stream;
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) || defined(__OS2__)
|
||||
_setmode(_fileno(stream), _O_BINARY);
|
||||
#endif
|
||||
return stream;
|
||||
|
10
usage.dox
10
usage.dox
@@ -1,6 +1,6 @@
|
||||
/*!\page usage Usage
|
||||
|
||||
The vpx Multi-Format codec SDK provides a unified interface amongst its
|
||||
The vpx multi-format codec SDK provides a unified interface amongst its
|
||||
supported codecs. This abstraction allows applications using this SDK to
|
||||
easily support multiple video formats with minimal code duplication or
|
||||
"special casing." This section describes the interface common to all codecs.
|
||||
@@ -14,8 +14,12 @@
|
||||
|
||||
Fore more information on decoder and encoder specific usage, see the
|
||||
following pages:
|
||||
\if decoder - \subpage usage_decode \endif
|
||||
\if decoder - \subpage usage_encode \endif
|
||||
\if decoder
|
||||
- \subpage usage_decode
|
||||
\endif
|
||||
\if decoder
|
||||
- \subpage usage_encode
|
||||
\endif
|
||||
|
||||
\section usage_types Important Data Types
|
||||
There are two important data structures to consider in this interface.
|
||||
|
@@ -17,43 +17,31 @@
|
||||
#include "entropymode.h"
|
||||
#include "systemdependent.h"
|
||||
|
||||
|
||||
extern void vp8_init_scan_order_mask();
|
||||
|
||||
static void update_mode_info_border(MODE_INFO *mi, int rows, int cols)
|
||||
{
|
||||
int i;
|
||||
vpx_memset(mi - cols - 2, 0, sizeof(MODE_INFO) * (cols + 1));
|
||||
|
||||
for (i = 0; i < rows; i++)
|
||||
{
|
||||
/* TODO(holmer): Bug? This updates the last element of each row
|
||||
* rather than the border element!
|
||||
*/
|
||||
vpx_memset(&mi[i*cols-1], 0, sizeof(MODE_INFO));
|
||||
}
|
||||
}
|
||||
|
||||
void vp8_de_alloc_frame_buffers(VP8_COMMON *oci)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_YV12_BUFFERS; i++)
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->yv12_fb[i]);
|
||||
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->temp_scale_frame);
|
||||
#if CONFIG_POSTPROC
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer);
|
||||
if (oci->post_proc_buffer_int_used)
|
||||
vp8_yv12_de_alloc_frame_buffer(&oci->post_proc_buffer_int);
|
||||
|
||||
vpx_free(oci->pp_limits_buffer);
|
||||
oci->pp_limits_buffer = NULL;
|
||||
#endif
|
||||
|
||||
vpx_free(oci->above_context);
|
||||
vpx_free(oci->mip);
|
||||
#if CONFIG_ERROR_CONCEALMENT
|
||||
vpx_free(oci->prev_mip);
|
||||
oci->prev_mip = NULL;
|
||||
#endif
|
||||
|
||||
oci->above_context = 0;
|
||||
oci->mip = 0;
|
||||
oci->prev_mip = 0;
|
||||
|
||||
oci->above_context = NULL;
|
||||
oci->mip = NULL;
|
||||
}
|
||||
|
||||
int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
|
||||
@@ -75,10 +63,7 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
|
||||
oci->fb_idx_ref_cnt[i] = 0;
|
||||
oci->yv12_fb[i].flags = 0;
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
goto allocation_fail;
|
||||
}
|
||||
|
||||
oci->new_fb_idx = 0;
|
||||
@@ -92,18 +77,7 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
|
||||
oci->fb_idx_ref_cnt[3] = 1;
|
||||
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
oci->post_proc_buffer_int_used = 0;
|
||||
goto allocation_fail;
|
||||
|
||||
oci->mb_rows = height >> 4;
|
||||
oci->mb_cols = width >> 4;
|
||||
@@ -112,44 +86,43 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height)
|
||||
oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
|
||||
|
||||
if (!oci->mip)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
goto allocation_fail;
|
||||
|
||||
oci->mi = oci->mip + oci->mode_info_stride + 1;
|
||||
|
||||
/* allocate memory for last frame MODE_INFO array */
|
||||
#if CONFIG_ERROR_CONCEALMENT
|
||||
oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO));
|
||||
|
||||
if (!oci->prev_mip)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
oci->prev_mi = oci->prev_mip + oci->mode_info_stride + 1;
|
||||
#else
|
||||
oci->prev_mip = NULL;
|
||||
oci->prev_mi = NULL;
|
||||
#endif
|
||||
/* Allocation of previous mode info will be done in vp8_decode_frame()
|
||||
* as it is a decoder only data */
|
||||
|
||||
oci->above_context = vpx_calloc(sizeof(ENTROPY_CONTEXT_PLANES) * oci->mb_cols, 1);
|
||||
|
||||
if (!oci->above_context)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
goto allocation_fail;
|
||||
|
||||
update_mode_info_border(oci->mi, oci->mb_rows, oci->mb_cols);
|
||||
#if CONFIG_ERROR_CONCEALMENT
|
||||
update_mode_info_border(oci->prev_mi, oci->mb_rows, oci->mb_cols);
|
||||
#if CONFIG_POSTPROC
|
||||
if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0)
|
||||
goto allocation_fail;
|
||||
|
||||
oci->post_proc_buffer_int_used = 0;
|
||||
vpx_memset(&oci->postproc_state, 0, sizeof(oci->postproc_state));
|
||||
vpx_memset(oci->post_proc_buffer.buffer_alloc, 128,
|
||||
oci->post_proc_buffer.frame_size);
|
||||
|
||||
/* Allocate buffer to store post-processing filter coefficients.
|
||||
*
|
||||
* Note: Round up mb_cols to support SIMD reads
|
||||
*/
|
||||
oci->pp_limits_buffer = vpx_memalign(16, 24 * ((oci->mb_cols + 1) & ~1));
|
||||
if (!oci->pp_limits_buffer)
|
||||
goto allocation_fail;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
allocation_fail:
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void vp8_setup_version(VP8_COMMON *cm)
|
||||
{
|
||||
switch (cm->version)
|
||||
@@ -203,7 +176,7 @@ void vp8_create_common(VP8_COMMON *oci)
|
||||
oci->clr_type = REG_YUV;
|
||||
oci->clamp_type = RECON_CLAMP_REQUIRED;
|
||||
|
||||
/* Initialise reference frame sign bias structure to defaults */
|
||||
/* Initialize reference frame sign bias structure to defaults */
|
||||
vpx_memset(oci->ref_frame_sign_bias, 0, sizeof(oci->ref_frame_sign_bias));
|
||||
|
||||
/* Default disable buffer to buffer copying */
|
||||
@@ -215,13 +188,3 @@ void vp8_remove_common(VP8_COMMON *oci)
|
||||
{
|
||||
vp8_de_alloc_frame_buffers(oci);
|
||||
}
|
||||
|
||||
void vp8_initialize_common()
|
||||
{
|
||||
vp8_coef_tree_initialize();
|
||||
|
||||
vp8_entropy_mode_init();
|
||||
|
||||
vp8_init_scan_order_mask();
|
||||
|
||||
}
|
||||
|
@@ -1,115 +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 "vpx_config.h"
|
||||
#include "vpx_ports/arm.h"
|
||||
#include "vp8/common/pragmas.h"
|
||||
#include "vp8/common/subpixel.h"
|
||||
#include "vp8/common/loopfilter.h"
|
||||
#include "vp8/common/recon.h"
|
||||
#include "vp8/common/idct.h"
|
||||
#include "vp8/common/onyxc_int.h"
|
||||
|
||||
void vp8_arch_arm_common_init(VP8_COMMON *ctx)
|
||||
{
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
VP8_COMMON_RTCD *rtcd = &ctx->rtcd;
|
||||
int flags = arm_cpu_caps();
|
||||
rtcd->flags = flags;
|
||||
|
||||
/* Override default functions with fastest ones for this CPU. */
|
||||
#if HAVE_ARMV5TE
|
||||
if (flags & HAS_EDSP)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV6
|
||||
if (flags & HAS_MEDIA)
|
||||
{
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_armv6;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_armv6;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_armv6;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_armv6;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_armv6;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_armv6;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_armv6;
|
||||
|
||||
rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual;
|
||||
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6;
|
||||
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_armv6;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_armv6;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_armv6;
|
||||
rtcd->loopfilter.simple_mb_v =
|
||||
vp8_loop_filter_simple_vertical_edge_armv6;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_armv6;
|
||||
rtcd->loopfilter.simple_mb_h =
|
||||
vp8_loop_filter_simple_horizontal_edge_armv6;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_armv6;
|
||||
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_v6;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_v6;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_v6;
|
||||
rtcd->recon.intra4x4_predict = vp8_intra4x4_predict_armv6;
|
||||
|
||||
rtcd->dequant.block = vp8_dequantize_b_v6;
|
||||
rtcd->dequant.idct_add = vp8_dequant_idct_add_v6;
|
||||
rtcd->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_v6;
|
||||
rtcd->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_v6;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
if (flags & HAS_NEON)
|
||||
{
|
||||
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_neon;
|
||||
rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_neon;
|
||||
rtcd->subpix.sixtap8x4 = vp8_sixtap_predict8x4_neon;
|
||||
rtcd->subpix.sixtap4x4 = vp8_sixtap_predict_neon;
|
||||
rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_neon;
|
||||
rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_neon;
|
||||
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon;
|
||||
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_neon;
|
||||
|
||||
rtcd->idct.idct16 = vp8_short_idct4x4llm_neon;
|
||||
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon;
|
||||
|
||||
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
|
||||
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_neon;
|
||||
rtcd->loopfilter.normal_mb_h = vp8_loop_filter_mbh_neon;
|
||||
rtcd->loopfilter.normal_b_h = vp8_loop_filter_bh_neon;
|
||||
rtcd->loopfilter.simple_mb_v = vp8_loop_filter_mbvs_neon;
|
||||
rtcd->loopfilter.simple_b_v = vp8_loop_filter_bvs_neon;
|
||||
rtcd->loopfilter.simple_mb_h = vp8_loop_filter_mbhs_neon;
|
||||
rtcd->loopfilter.simple_b_h = vp8_loop_filter_bhs_neon;
|
||||
|
||||
rtcd->recon.copy16x16 = vp8_copy_mem16x16_neon;
|
||||
rtcd->recon.copy8x8 = vp8_copy_mem8x8_neon;
|
||||
rtcd->recon.copy8x4 = vp8_copy_mem8x4_neon;
|
||||
rtcd->recon.build_intra_predictors_mby =
|
||||
vp8_build_intra_predictors_mby_neon;
|
||||
rtcd->recon.build_intra_predictors_mby_s =
|
||||
vp8_build_intra_predictors_mby_s_neon;
|
||||
|
||||
rtcd->dequant.block = vp8_dequantize_b_neon;
|
||||
rtcd->dequant.idct_add = vp8_dequant_idct_add_neon;
|
||||
rtcd->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_neon;
|
||||
rtcd->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_neon;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
@@ -9,8 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vp8/common/idct.h"
|
||||
#include "vp8/common/dequantize.h"
|
||||
#include "vpx_rtcd.h"
|
||||
|
||||
|
||||
void vp8_dequant_idct_add_y_block_v6(short *q, short *dq,
|
||||
|
@@ -18,15 +18,23 @@
|
||||
AREA ||.text||, CODE, READONLY, ALIGN=2
|
||||
|
||||
|
||||
;void vp8_intra4x4_predict(unsigned char *src, int src_stride, int b_mode,
|
||||
; unsigned char *dst, int dst_stride)
|
||||
;void vp8_intra4x4_predict_armv6(unsigned char *Above, unsigned char *yleft,
|
||||
; B_PREDICTION_MODE left_stride, int b_mode,
|
||||
; unsigned char *dst, int dst_stride,
|
||||
; unsigned char top_left)
|
||||
|
||||
; r0: *Above
|
||||
; r1: *yleft
|
||||
; r2: left_stride
|
||||
; r3: b_mode
|
||||
; sp + #40: dst
|
||||
; sp + #44: dst_stride
|
||||
; sp + #48: top_left
|
||||
|vp8_intra4x4_predict_armv6| PROC
|
||||
push {r4-r12, lr}
|
||||
|
||||
|
||||
cmp r2, #10
|
||||
addlt pc, pc, r2, lsl #2 ; position independent switch
|
||||
cmp r3, #10
|
||||
addlt pc, pc, r3, lsl #2 ; position independent switch
|
||||
pop {r4-r12, pc} ; default
|
||||
b b_dc_pred
|
||||
b b_tm_pred
|
||||
@@ -41,13 +49,13 @@
|
||||
|
||||
b_dc_pred
|
||||
; load values
|
||||
ldr r8, [r0, -r1] ; Above
|
||||
ldrb r4, [r0, #-1]! ; Left[0]
|
||||
ldr r8, [r0] ; Above
|
||||
ldrb r4, [r1], r2 ; Left[0]
|
||||
mov r9, #0
|
||||
ldrb r5, [r0, r1] ; Left[1]
|
||||
ldrb r6, [r0, r1, lsl #1]! ; Left[2]
|
||||
ldrb r5, [r1], r2 ; Left[1]
|
||||
ldrb r6, [r1], r2 ; Left[2]
|
||||
usad8 r12, r8, r9
|
||||
ldrb r7, [r0, r1] ; Left[3]
|
||||
ldrb r7, [r1] ; Left[3]
|
||||
|
||||
; calculate dc
|
||||
add r4, r4, r5
|
||||
@@ -55,31 +63,30 @@ b_dc_pred
|
||||
add r4, r4, r7
|
||||
add r4, r4, r12
|
||||
add r4, r4, #4
|
||||
ldr r0, [sp, #40] ; load stride
|
||||
ldr r0, [sp, #44] ; dst_stride
|
||||
mov r12, r4, asr #3 ; (expected_dc + 4) >> 3
|
||||
|
||||
add r12, r12, r12, lsl #8
|
||||
add r3, r3, r0
|
||||
ldr r3, [sp, #40] ; dst
|
||||
add r12, r12, r12, lsl #16
|
||||
|
||||
; store values
|
||||
str r12, [r3, -r0]
|
||||
str r12, [r3], r0
|
||||
str r12, [r3], r0
|
||||
str r12, [r3], r0
|
||||
str r12, [r3]
|
||||
str r12, [r3, r0]
|
||||
str r12, [r3, r0, lsl #1]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
b_tm_pred
|
||||
sub r10, r0, #1 ; Left
|
||||
ldr r8, [r0, -r1] ; Above
|
||||
ldrb r9, [r10, -r1] ; top_left
|
||||
ldrb r4, [r0, #-1]! ; Left[0]
|
||||
ldrb r5, [r10, r1]! ; Left[1]
|
||||
ldrb r6, [r0, r1, lsl #1] ; Left[2]
|
||||
ldrb r7, [r10, r1, lsl #1] ; Left[3]
|
||||
ldr r0, [sp, #40] ; load stride
|
||||
|
||||
ldr r8, [r0] ; Above
|
||||
ldrb r9, [sp, #48] ; top_left
|
||||
ldrb r4, [r1], r2 ; Left[0]
|
||||
ldrb r5, [r1], r2 ; Left[1]
|
||||
ldrb r6, [r1], r2 ; Left[2]
|
||||
ldrb r7, [r1] ; Left[3]
|
||||
ldr r0, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
|
||||
add r9, r9, r9, lsl #16 ; [tl|tl]
|
||||
uxtb16 r10, r8 ; a[2|0]
|
||||
@@ -126,25 +133,26 @@ b_tm_pred
|
||||
str r12, [r3], r0
|
||||
|
||||
add r12, r4, r5, lsl #8 ; [3|2|1|0]
|
||||
str r12, [r3], r0
|
||||
str r12, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
b_ve_pred
|
||||
ldr r8, [r0, -r1]! ; a[3|2|1|0]
|
||||
ldr r8, [r0] ; a[3|2|1|0]
|
||||
ldr r11, c00FF00FF
|
||||
ldrb r9, [r0, #-1] ; top_left
|
||||
ldrb r9, [sp, #48] ; top_left
|
||||
ldrb r10, [r0, #4] ; a[4]
|
||||
|
||||
ldr r0, c00020002
|
||||
|
||||
uxtb16 r4, r8 ; a[2|0]
|
||||
uxtb16 r5, r8, ror #8 ; a[3|1]
|
||||
ldr r2, [sp, #40] ; stride
|
||||
ldr r2, [sp, #44] ; dst_stride
|
||||
pkhbt r9, r9, r5, lsl #16 ; a[1|-1]
|
||||
|
||||
add r9, r9, r4, lsl #1 ;[a[1]+2*a[2] | tl+2*a[0] ]
|
||||
uxtab16 r9, r9, r5 ;[a[1]+2*a[2]+a[3] | tl+2*a[0]+a[1] ]
|
||||
ldr r3, [sp, #40] ; dst
|
||||
uxtab16 r9, r9, r0 ;[a[1]+2*a[2]+a[3]+2| tl+2*a[0]+a[1]+2]
|
||||
|
||||
add r0, r0, r10, lsl #16 ;[a[4]+2 | 2]
|
||||
@@ -154,25 +162,23 @@ b_ve_pred
|
||||
|
||||
and r9, r11, r9, asr #2
|
||||
and r4, r11, r4, asr #2
|
||||
add r3, r3, r2 ; dst + dst_stride
|
||||
add r9, r9, r4, lsl #8
|
||||
|
||||
; store values
|
||||
str r9, [r3, -r2]
|
||||
str r9, [r3], r2
|
||||
str r9, [r3], r2
|
||||
str r9, [r3], r2
|
||||
str r9, [r3]
|
||||
str r9, [r3, r2]
|
||||
str r9, [r3, r2, lsl #1]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
|
||||
b_he_pred
|
||||
sub r10, r0, #1 ; Left
|
||||
ldrb r4, [r0, #-1]! ; Left[0]
|
||||
ldrb r8, [r10, -r1] ; top_left
|
||||
ldrb r5, [r10, r1]! ; Left[1]
|
||||
ldrb r6, [r0, r1, lsl #1] ; Left[2]
|
||||
ldrb r7, [r10, r1, lsl #1] ; Left[3]
|
||||
ldrb r4, [r1], r2 ; Left[0]
|
||||
ldrb r8, [sp, #48] ; top_left
|
||||
ldrb r5, [r1], r2 ; Left[1]
|
||||
ldrb r6, [r1], r2 ; Left[2]
|
||||
ldrb r7, [r1] ; Left[3]
|
||||
|
||||
add r8, r8, r4 ; tl + l[0]
|
||||
add r9, r4, r5 ; l[0] + l[1]
|
||||
@@ -197,7 +203,8 @@ b_he_pred
|
||||
pkhtb r10, r10, r10, asr #16 ; l[-|2|-|2]
|
||||
pkhtb r11, r11, r11, asr #16 ; l[-|3|-|3]
|
||||
|
||||
ldr r0, [sp, #40] ; stride
|
||||
ldr r0, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
|
||||
add r8, r8, r8, lsl #8 ; l[0|0|0|0]
|
||||
add r9, r9, r9, lsl #8 ; l[1|1|1|1]
|
||||
@@ -206,16 +213,16 @@ b_he_pred
|
||||
|
||||
; store values
|
||||
str r8, [r3], r0
|
||||
str r9, [r3]
|
||||
str r10, [r3, r0]
|
||||
str r11, [r3, r0, lsl #1]
|
||||
str r9, [r3], r0
|
||||
str r10, [r3], r0
|
||||
str r11, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
b_ld_pred
|
||||
ldr r4, [r0, -r1]! ; Above
|
||||
ldr r4, [r0] ; Above[0-3]
|
||||
ldr r12, c00020002
|
||||
ldr r5, [r0, #4]
|
||||
ldr r5, [r0, #4] ; Above[4-7]
|
||||
ldr lr, c00FF00FF
|
||||
|
||||
uxtb16 r6, r4 ; a[2|0]
|
||||
@@ -225,7 +232,6 @@ b_ld_pred
|
||||
pkhtb r10, r6, r8 ; a[2|4]
|
||||
pkhtb r11, r7, r9 ; a[3|5]
|
||||
|
||||
|
||||
add r4, r6, r7, lsl #1 ; [a2+2*a3 | a0+2*a1]
|
||||
add r4, r4, r10, ror #16 ; [a2+2*a3+a4 | a0+2*a1+a2]
|
||||
uxtab16 r4, r4, r12 ; [a2+2*a3+a4+2 | a0+2*a1+a2+2]
|
||||
@@ -244,7 +250,8 @@ b_ld_pred
|
||||
add r7, r7, r9, asr #16 ; [ a5+2*a6+a7]
|
||||
uxtah r7, r7, r12 ; [ a5+2*a6+a7+2]
|
||||
|
||||
ldr r0, [sp, #40] ; stride
|
||||
ldr r0, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
|
||||
; scale down
|
||||
and r4, lr, r4, asr #2
|
||||
@@ -266,18 +273,17 @@ b_ld_pred
|
||||
mov r6, r6, lsr #16
|
||||
mov r11, r10, lsr #8
|
||||
add r11, r11, r6, lsl #24 ; [6|5|4|3]
|
||||
str r11, [r3], r0
|
||||
str r11, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
b_rd_pred
|
||||
sub r12, r0, r1 ; Above = src - src_stride
|
||||
ldrb r7, [r0, #-1]! ; l[0] = pp[3]
|
||||
ldr lr, [r12] ; Above = pp[8|7|6|5]
|
||||
ldrb r8, [r12, #-1]! ; tl = pp[4]
|
||||
ldrb r6, [r12, r1, lsl #1] ; l[1] = pp[2]
|
||||
ldrb r5, [r0, r1, lsl #1] ; l[2] = pp[1]
|
||||
ldrb r4, [r12, r1, lsl #2] ; l[3] = pp[0]
|
||||
ldrb r7, [r1], r2 ; l[0] = pp[3]
|
||||
ldr lr, [r0] ; Above = pp[8|7|6|5]
|
||||
ldrb r8, [sp, #48] ; tl = pp[4]
|
||||
ldrb r6, [r1], r2 ; l[1] = pp[2]
|
||||
ldrb r5, [r1], r2 ; l[2] = pp[1]
|
||||
ldrb r4, [r1], r2 ; l[3] = pp[0]
|
||||
|
||||
|
||||
uxtb16 r9, lr ; p[7|5]
|
||||
@@ -307,7 +313,8 @@ b_rd_pred
|
||||
add r7, r7, r10 ; [p6+2*p7+p8 | p4+2*p5+p6]
|
||||
uxtab16 r7, r7, r12 ; [p6+2*p7+p8+2 | p4+2*p5+p6+2]
|
||||
|
||||
ldr r0, [sp, #40] ; stride
|
||||
ldr r0, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
|
||||
; scale down
|
||||
and r7, lr, r7, asr #2
|
||||
@@ -328,18 +335,17 @@ b_rd_pred
|
||||
|
||||
mov r11, r10, lsl #8 ; [3|2|1|-]
|
||||
uxtab r11, r11, r4 ; [3|2|1|0]
|
||||
str r11, [r3], r0
|
||||
str r11, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
b_vr_pred
|
||||
sub r12, r0, r1 ; Above = src - src_stride
|
||||
ldrb r7, [r0, #-1]! ; l[0] = pp[3]
|
||||
ldr lr, [r12] ; Above = pp[8|7|6|5]
|
||||
ldrb r8, [r12, #-1]! ; tl = pp[4]
|
||||
ldrb r6, [r12, r1, lsl #1] ; l[1] = pp[2]
|
||||
ldrb r5, [r0, r1, lsl #1] ; l[2] = pp[1]
|
||||
ldrb r4, [r12, r1, lsl #2] ; l[3] = pp[0]
|
||||
ldrb r7, [r1], r2 ; l[0] = pp[3]
|
||||
ldr lr, [r0] ; Above = pp[8|7|6|5]
|
||||
ldrb r8, [sp, #48] ; tl = pp[4]
|
||||
ldrb r6, [r1], r2 ; l[1] = pp[2]
|
||||
ldrb r5, [r1], r2 ; l[2] = pp[1]
|
||||
ldrb r4, [r1] ; l[3] = pp[0]
|
||||
|
||||
add r5, r5, r7, lsl #16 ; p[3|1]
|
||||
add r6, r6, r8, lsl #16 ; p[4|2]
|
||||
@@ -376,7 +382,8 @@ b_vr_pred
|
||||
add r8, r8, r10 ; [p6+2*p7+p8 | p4+2*p5+p6]
|
||||
uxtab16 r8, r8, r12 ; [p6+2*p7+p8+2 | p4+2*p5+p6+2]
|
||||
|
||||
ldr r0, [sp, #40] ; stride
|
||||
ldr r0, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
|
||||
; scale down
|
||||
and r5, lr, r5, asr #2 ; [B|A]
|
||||
@@ -397,14 +404,14 @@ b_vr_pred
|
||||
pkhtb r10, r7, r5, asr #16 ; [-|H|-|B]
|
||||
str r2, [r3], r0
|
||||
add r12, r12, r10, lsl #8 ; [H|D|B|A]
|
||||
str r12, [r3], r0
|
||||
str r12, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
b_vl_pred
|
||||
ldr r4, [r0, -r1]! ; [3|2|1|0]
|
||||
ldr r4, [r0] ; [3|2|1|0] = Above[0-3]
|
||||
ldr r12, c00020002
|
||||
ldr r5, [r0, #4] ; [7|6|5|4]
|
||||
ldr r5, [r0, #4] ; [7|6|5|4] = Above[4-7]
|
||||
ldr lr, c00FF00FF
|
||||
ldr r2, c00010001
|
||||
|
||||
@@ -441,7 +448,8 @@ b_vl_pred
|
||||
add r9, r9, r11 ; [p5+2*p6+p7 | p3+2*p4+p5]
|
||||
uxtab16 r9, r9, r12 ; [p5+2*p6+p7+2 | p3+2*p4+p5+2]
|
||||
|
||||
ldr r0, [sp, #40] ; stride
|
||||
ldr r0, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
|
||||
; scale down
|
||||
and r5, lr, r5, asr #2 ; [D|C]
|
||||
@@ -449,7 +457,6 @@ b_vl_pred
|
||||
and r8, lr, r8, asr #2 ; [I|D]
|
||||
and r9, lr, r9, asr #2 ; [J|H]
|
||||
|
||||
|
||||
add r10, r4, r6, lsl #8 ; [F|B|E|A]
|
||||
str r10, [r3], r0
|
||||
|
||||
@@ -463,18 +470,17 @@ b_vl_pred
|
||||
str r12, [r3], r0
|
||||
|
||||
add r10, r7, r10, lsl #8 ; [J|H|D|G]
|
||||
str r10, [r3], r0
|
||||
str r10, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
b_hd_pred
|
||||
sub r12, r0, r1 ; Above = src - src_stride
|
||||
ldrb r7, [r0, #-1]! ; l[0] = pp[3]
|
||||
ldr lr, [r12] ; Above = pp[8|7|6|5]
|
||||
ldrb r8, [r12, #-1]! ; tl = pp[4]
|
||||
ldrb r6, [r0, r1] ; l[1] = pp[2]
|
||||
ldrb r5, [r0, r1, lsl #1] ; l[2] = pp[1]
|
||||
ldrb r4, [r12, r1, lsl #2] ; l[3] = pp[0]
|
||||
ldrb r7, [r1], r2 ; l[0] = pp[3]
|
||||
ldr lr, [r0] ; Above = pp[8|7|6|5]
|
||||
ldrb r8, [sp, #48] ; tl = pp[4]
|
||||
ldrb r6, [r1], r2 ; l[1] = pp[2]
|
||||
ldrb r5, [r1], r2 ; l[2] = pp[1]
|
||||
ldrb r4, [r1] ; l[3] = pp[0]
|
||||
|
||||
uxtb16 r9, lr ; p[7|5]
|
||||
uxtb16 r10, lr, ror #8 ; p[8|6]
|
||||
@@ -492,7 +498,6 @@ b_hd_pred
|
||||
pkhtb r1, r9, r10 ; p[7|6]
|
||||
pkhbt r10, r8, r10, lsl #16 ; p[6|5]
|
||||
|
||||
|
||||
uadd16 r11, r4, r5 ; [p1+p2 | p0+p1]
|
||||
uhadd16 r11, r11, r2 ; [(p1+p2+1)>>1 | (p0+p1+1)>>1]
|
||||
; [B|A]
|
||||
@@ -518,7 +523,8 @@ b_hd_pred
|
||||
and r5, lr, r5, asr #2 ; [H|G]
|
||||
and r6, lr, r6, asr #2 ; [J|I]
|
||||
|
||||
ldr lr, [sp, #40] ; stride
|
||||
ldr lr, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
|
||||
pkhtb r2, r0, r6 ; [-|F|-|I]
|
||||
pkhtb r12, r6, r5, asr #16 ; [-|J|-|H]
|
||||
@@ -527,7 +533,6 @@ b_hd_pred
|
||||
mov r12, r12, ror #24 ; [J|I|H|F]
|
||||
str r12, [r3], lr
|
||||
|
||||
|
||||
mov r7, r11, asr #16 ; [-|-|-|B]
|
||||
str r2, [r3], lr
|
||||
add r7, r7, r0, lsl #16 ; [-|E|-|B]
|
||||
@@ -536,21 +541,20 @@ b_hd_pred
|
||||
str r7, [r3], lr
|
||||
|
||||
add r5, r11, r4, lsl #8 ; [D|B|C|A]
|
||||
str r5, [r3], lr
|
||||
str r5, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
|
||||
|
||||
b_hu_pred
|
||||
ldrb r4, [r0, #-1]! ; Left[0]
|
||||
ldrb r4, [r1], r2 ; Left[0]
|
||||
ldr r12, c00020002
|
||||
ldrb r5, [r0, r1]! ; Left[1]
|
||||
ldrb r5, [r1], r2 ; Left[1]
|
||||
ldr lr, c00FF00FF
|
||||
ldrb r6, [r0, r1]! ; Left[2]
|
||||
ldrb r6, [r1], r2 ; Left[2]
|
||||
ldr r2, c00010001
|
||||
ldrb r7, [r0, r1] ; Left[3]
|
||||
|
||||
ldrb r7, [r1] ; Left[3]
|
||||
|
||||
add r4, r4, r5, lsl #16 ; [1|0]
|
||||
add r5, r5, r6, lsl #16 ; [2|1]
|
||||
@@ -563,7 +567,8 @@ b_hu_pred
|
||||
add r4, r4, r5, lsl #1 ; [p1+2*p2 | p0+2*p1]
|
||||
add r4, r4, r9 ; [p1+2*p2+p3 | p0+2*p1+p2]
|
||||
uxtab16 r4, r4, r12 ; [p1+2*p2+p3+2 | p0+2*p1+p2+2]
|
||||
ldr r2, [sp, #40] ; stride
|
||||
ldr r2, [sp, #44] ; dst_stride
|
||||
ldr r3, [sp, #40] ; dst
|
||||
and r4, lr, r4, asr #2 ; [D|C]
|
||||
|
||||
add r10, r6, r7 ; [p2+p3]
|
||||
@@ -587,9 +592,9 @@ b_hu_pred
|
||||
|
||||
add r10, r11, lsl #8 ; [-|-|F|E]
|
||||
add r10, r10, r9, lsl #16 ; [G|G|F|E]
|
||||
str r10, [r3]
|
||||
str r10, [r3], r2
|
||||
|
||||
str r7, [r3, r2]
|
||||
str r7, [r3]
|
||||
|
||||
pop {r4-r12, pc}
|
||||
|
||||
|
@@ -144,7 +144,7 @@ loop
|
||||
ldr r6, [sp, #40] ; get address of sse
|
||||
mul r0, r8, r8 ; sum * sum
|
||||
str r11, [r6] ; store sse
|
||||
sub r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
|
||||
ldmfd sp!, {r4-r12, pc}
|
||||
|
@@ -169,7 +169,7 @@ loop
|
||||
ldr r6, [sp, #40] ; get address of sse
|
||||
mul r0, r8, r8 ; sum * sum
|
||||
str r11, [r6] ; store sse
|
||||
sub r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
|
||||
ldmfd sp!, {r4-r12, pc}
|
||||
|
@@ -210,7 +210,7 @@ loop
|
||||
ldr r6, [sp, #40] ; get address of sse
|
||||
mul r0, r8, r8 ; sum * sum
|
||||
str r11, [r6] ; store sse
|
||||
sub r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
|
||||
ldmfd sp!, {r4-r12, pc}
|
||||
|
@@ -171,7 +171,7 @@ loop
|
||||
ldr r6, [sp, #40] ; get address of sse
|
||||
mul r0, r8, r8 ; sum * sum
|
||||
str r11, [r6] ; store sse
|
||||
sub r0, r11, r0, asr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
sub r0, r11, r0, lsr #8 ; return (sse - ((sum * sum) >> 8))
|
||||
|
||||
ldmfd sp!, {r4-r12, pc}
|
||||
|
@@ -8,10 +8,10 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include <math.h>
|
||||
#include "vp8/common/filter.h"
|
||||
#include "vp8/common/subpixel.h"
|
||||
#include "bilinearfilter_arm.h"
|
||||
|
||||
void vp8_filter_block2d_bil_armv6
|
||||
|
@@ -10,18 +10,17 @@
|
||||
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vp8/common/dequantize.h"
|
||||
#include "vp8/common/idct.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
|
||||
#if HAVE_ARMV7
|
||||
#if HAVE_NEON
|
||||
extern void vp8_dequantize_b_loop_neon(short *Q, short *DQC, short *DQ);
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV6
|
||||
#if HAVE_MEDIA
|
||||
extern void vp8_dequantize_b_loop_v6(short *Q, short *DQC, short *DQ);
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
#if HAVE_NEON
|
||||
|
||||
void vp8_dequantize_b_neon(BLOCKD *d, short *DQC)
|
||||
{
|
||||
@@ -32,7 +31,7 @@ void vp8_dequantize_b_neon(BLOCKD *d, short *DQC)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV6
|
||||
#if HAVE_MEDIA
|
||||
void vp8_dequantize_b_v6(BLOCKD *d, short *DQC)
|
||||
{
|
||||
short *DQ = d->dqcoeff;
|
||||
|
@@ -1,59 +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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DEQUANTIZE_ARM_H
|
||||
#define DEQUANTIZE_ARM_H
|
||||
|
||||
#if HAVE_ARMV6
|
||||
extern prototype_dequant_block(vp8_dequantize_b_v6);
|
||||
extern prototype_dequant_idct_add(vp8_dequant_idct_add_v6);
|
||||
extern prototype_dequant_idct_add_y_block(vp8_dequant_idct_add_y_block_v6);
|
||||
extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block_v6);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_dequant_block
|
||||
#define vp8_dequant_block vp8_dequantize_b_v6
|
||||
|
||||
#undef vp8_dequant_idct_add
|
||||
#define vp8_dequant_idct_add vp8_dequant_idct_add_v6
|
||||
|
||||
#undef vp8_dequant_idct_add_y_block
|
||||
#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_v6
|
||||
|
||||
#undef vp8_dequant_idct_add_uv_block
|
||||
#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_v6
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
extern prototype_dequant_block(vp8_dequantize_b_neon);
|
||||
extern prototype_dequant_idct_add(vp8_dequant_idct_add_neon);
|
||||
extern prototype_dequant_idct_add_y_block(vp8_dequant_idct_add_y_block_neon);
|
||||
extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block_neon);
|
||||
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_dequant_block
|
||||
#define vp8_dequant_block vp8_dequantize_b_neon
|
||||
|
||||
#undef vp8_dequant_idct_add
|
||||
#define vp8_dequant_idct_add vp8_dequant_idct_add_neon
|
||||
|
||||
#undef vp8_dequant_idct_add_y_block
|
||||
#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_neon
|
||||
|
||||
#undef vp8_dequant_idct_add_uv_block
|
||||
#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_neon
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -10,9 +10,9 @@
|
||||
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include <math.h>
|
||||
#include "vp8/common/filter.h"
|
||||
#include "vp8/common/subpixel.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
|
||||
extern void vp8_filter_block2d_first_pass_armv6
|
||||
@@ -86,8 +86,8 @@ extern void vp8_filter_block2d_second_pass_only_armv6
|
||||
const short *vp8_filter
|
||||
);
|
||||
|
||||
#if HAVE_ARMV6
|
||||
void vp8_sixtap_predict_armv6
|
||||
#if HAVE_MEDIA
|
||||
void vp8_sixtap_predict4x4_armv6
|
||||
(
|
||||
unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
|
@@ -1,51 +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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef IDCT_ARM_H
|
||||
#define IDCT_ARM_H
|
||||
|
||||
#if HAVE_ARMV6
|
||||
extern prototype_idct(vp8_short_idct4x4llm_v6_dual);
|
||||
extern prototype_idct_scalar_add(vp8_dc_only_idct_add_v6);
|
||||
extern prototype_second_order(vp8_short_inv_walsh4x4_1_v6);
|
||||
extern prototype_second_order(vp8_short_inv_walsh4x4_v6);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_idct_idct16
|
||||
#define vp8_idct_idct16 vp8_short_idct4x4llm_v6_dual
|
||||
|
||||
#undef vp8_idct_idct1_scalar_add
|
||||
#define vp8_idct_idct1_scalar_add vp8_dc_only_idct_add_v6
|
||||
|
||||
#undef vp8_idct_iwalsh16
|
||||
#define vp8_idct_iwalsh16 vp8_short_inv_walsh4x4_v6
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
extern prototype_idct(vp8_short_idct4x4llm_neon);
|
||||
extern prototype_idct_scalar_add(vp8_dc_only_idct_add_neon);
|
||||
extern prototype_second_order(vp8_short_inv_walsh4x4_1_neon);
|
||||
extern prototype_second_order(vp8_short_inv_walsh4x4_neon);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_idct_idct16
|
||||
#define vp8_idct_idct16 vp8_short_idct4x4llm_neon
|
||||
|
||||
#undef vp8_idct_idct1_scalar_add
|
||||
#define vp8_idct_idct1_scalar_add vp8_dc_only_idct_add_neon
|
||||
|
||||
#undef vp8_idct_iwalsh16
|
||||
#define vp8_idct_iwalsh16 vp8_short_inv_walsh4x4_neon
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -10,17 +10,22 @@
|
||||
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include "vp8/common/loopfilter.h"
|
||||
#include "vp8/common/onyxc_int.h"
|
||||
|
||||
#if HAVE_ARMV6
|
||||
#define prototype_loopfilter(sym) \
|
||||
void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
|
||||
const unsigned char *limit, const unsigned char *thresh, int count)
|
||||
|
||||
#if HAVE_MEDIA
|
||||
extern prototype_loopfilter(vp8_loop_filter_horizontal_edge_armv6);
|
||||
extern prototype_loopfilter(vp8_loop_filter_vertical_edge_armv6);
|
||||
extern prototype_loopfilter(vp8_mbloop_filter_horizontal_edge_armv6);
|
||||
extern prototype_loopfilter(vp8_mbloop_filter_vertical_edge_armv6);
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
#if HAVE_NEON
|
||||
typedef void loopfilter_y_neon(unsigned char *src, int pitch,
|
||||
unsigned char blimit, unsigned char limit, unsigned char thresh);
|
||||
typedef void loopfilter_uv_neon(unsigned char *u, int pitch,
|
||||
@@ -38,8 +43,8 @@ extern loopfilter_uv_neon vp8_mbloop_filter_horizontal_edge_uv_neon;
|
||||
extern loopfilter_uv_neon vp8_mbloop_filter_vertical_edge_uv_neon;
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV6
|
||||
/*ARMV6 loopfilter functions*/
|
||||
#if HAVE_MEDIA
|
||||
/* ARMV6/MEDIA loopfilter functions*/
|
||||
/* Horizontal MB filtering */
|
||||
void vp8_loop_filter_mbh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
int y_stride, int uv_stride, loop_filter_info *lfi)
|
||||
@@ -113,7 +118,7 @@ void vp8_loop_filter_bvs_armv6(unsigned char *y_ptr, int y_stride,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
#if HAVE_NEON
|
||||
/* NEON loopfilter functions */
|
||||
/* Horizontal MB filtering */
|
||||
void vp8_loop_filter_mbh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
|
||||
|
@@ -1,93 +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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LOOPFILTER_ARM_H
|
||||
#define LOOPFILTER_ARM_H
|
||||
|
||||
#include "vpx_config.h"
|
||||
|
||||
#if HAVE_ARMV6
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_mbv_armv6);
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_bv_armv6);
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_mbh_armv6);
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_bh_armv6);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_bvs_armv6);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_bhs_armv6);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_simple_horizontal_edge_armv6);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_simple_vertical_edge_armv6);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_lf_normal_mb_v
|
||||
#define vp8_lf_normal_mb_v vp8_loop_filter_mbv_armv6
|
||||
|
||||
#undef vp8_lf_normal_b_v
|
||||
#define vp8_lf_normal_b_v vp8_loop_filter_bv_armv6
|
||||
|
||||
#undef vp8_lf_normal_mb_h
|
||||
#define vp8_lf_normal_mb_h vp8_loop_filter_mbh_armv6
|
||||
|
||||
#undef vp8_lf_normal_b_h
|
||||
#define vp8_lf_normal_b_h vp8_loop_filter_bh_armv6
|
||||
|
||||
#undef vp8_lf_simple_mb_v
|
||||
#define vp8_lf_simple_mb_v vp8_loop_filter_simple_vertical_edge_armv6
|
||||
|
||||
#undef vp8_lf_simple_b_v
|
||||
#define vp8_lf_simple_b_v vp8_loop_filter_bvs_armv6
|
||||
|
||||
#undef vp8_lf_simple_mb_h
|
||||
#define vp8_lf_simple_mb_h vp8_loop_filter_simple_horizontal_edge_armv6
|
||||
|
||||
#undef vp8_lf_simple_b_h
|
||||
#define vp8_lf_simple_b_h vp8_loop_filter_bhs_armv6
|
||||
#endif /* !CONFIG_RUNTIME_CPU_DETECT */
|
||||
|
||||
#endif /* HAVE_ARMV6 */
|
||||
|
||||
#if HAVE_ARMV7
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_mbv_neon);
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_bv_neon);
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_mbh_neon);
|
||||
extern prototype_loopfilter_block(vp8_loop_filter_bh_neon);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_mbvs_neon);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_bvs_neon);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_mbhs_neon);
|
||||
extern prototype_simple_loopfilter(vp8_loop_filter_bhs_neon);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_lf_normal_mb_v
|
||||
#define vp8_lf_normal_mb_v vp8_loop_filter_mbv_neon
|
||||
|
||||
#undef vp8_lf_normal_b_v
|
||||
#define vp8_lf_normal_b_v vp8_loop_filter_bv_neon
|
||||
|
||||
#undef vp8_lf_normal_mb_h
|
||||
#define vp8_lf_normal_mb_h vp8_loop_filter_mbh_neon
|
||||
|
||||
#undef vp8_lf_normal_b_h
|
||||
#define vp8_lf_normal_b_h vp8_loop_filter_bh_neon
|
||||
|
||||
#undef vp8_lf_simple_mb_v
|
||||
#define vp8_lf_simple_mb_v vp8_loop_filter_mbvs_neon
|
||||
|
||||
#undef vp8_lf_simple_b_v
|
||||
#define vp8_lf_simple_b_v vp8_loop_filter_bvs_neon
|
||||
|
||||
#undef vp8_lf_simple_mb_h
|
||||
#define vp8_lf_simple_mb_h vp8_loop_filter_mbhs_neon
|
||||
|
||||
#undef vp8_lf_simple_b_h
|
||||
#define vp8_lf_simple_b_h vp8_loop_filter_bhs_neon
|
||||
#endif /* !CONFIG_RUNTIME_CPU_DETECT */
|
||||
|
||||
#endif /* HAVE_ARMV7 */
|
||||
|
||||
#endif /* LOOPFILTER_ARM_H */
|
@@ -46,7 +46,7 @@
|
||||
vst1.32 {d2[1]}, [r3], r12
|
||||
vst1.32 {d4[0]}, [r3], r12
|
||||
vst1.32 {d4[1]}, [r3]
|
||||
|
||||
|
||||
bx lr
|
||||
|
||||
ENDP
|
||||
|
@@ -9,8 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vp8/common/idct.h"
|
||||
#include "vp8/common/dequantize.h"
|
||||
#include "vpx_rtcd.h"
|
||||
|
||||
/* place these declarations here because we don't want to maintain them
|
||||
* outside of this scope
|
||||
|
@@ -9,7 +9,7 @@
|
||||
;
|
||||
|
||||
|
||||
EXPORT |vp8_sixtap_predict_neon|
|
||||
EXPORT |vp8_sixtap_predict4x4_neon|
|
||||
ARM
|
||||
REQUIRE8
|
||||
PRESERVE8
|
||||
@@ -33,7 +33,7 @@ filter4_coeff
|
||||
; stack(r4) unsigned char *dst_ptr,
|
||||
; stack(lr) int dst_pitch
|
||||
|
||||
|vp8_sixtap_predict_neon| PROC
|
||||
|vp8_sixtap_predict4x4_neon| PROC
|
||||
push {r4, lr}
|
||||
|
||||
adr r12, filter4_coeff
|
||||
|
@@ -77,14 +77,14 @@ variance16x16_neon_loop
|
||||
;vmov.32 r1, d1[0]
|
||||
;mul r0, r0, r0
|
||||
;str r1, [r12]
|
||||
;sub r0, r1, r0, asr #8
|
||||
;sub r0, r1, r0, lsr #8
|
||||
|
||||
;sum is in [-255x256, 255x256]. sumxsum is 32-bit. Shift to right should
|
||||
;have sign-bit exension, which is vshr.s. Have to use s32 to make it right.
|
||||
; while sum is signed, sum * sum is always positive and must be treated as
|
||||
; unsigned to avoid propagating the sign bit.
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [r12] ;store sse
|
||||
vshr.s32 d10, d10, #8
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #8
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
bx lr
|
||||
@@ -145,8 +145,8 @@ variance16x8_neon_loop
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [r12] ;store sse
|
||||
vshr.s32 d10, d10, #7
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #7
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
bx lr
|
||||
@@ -200,8 +200,8 @@ variance8x16_neon_loop
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [r12] ;store sse
|
||||
vshr.s32 d10, d10, #7
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #7
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
bx lr
|
||||
@@ -265,8 +265,8 @@ variance8x8_neon_loop
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [r12] ;store sse
|
||||
vshr.s32 d10, d10, #6
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #6
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
bx lr
|
@@ -9,6 +9,11 @@
|
||||
;
|
||||
|
||||
|
||||
bilinear_taps_coeff
|
||||
DCD 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
|
||||
|
||||
;-----------------
|
||||
|
||||
EXPORT |vp8_sub_pixel_variance16x16_neon_func|
|
||||
ARM
|
||||
REQUIRE8
|
||||
@@ -27,7 +32,7 @@
|
||||
|vp8_sub_pixel_variance16x16_neon_func| PROC
|
||||
push {r4-r6, lr}
|
||||
|
||||
ldr r12, _BilinearTaps_coeff_
|
||||
adr r12, bilinear_taps_coeff
|
||||
ldr r4, [sp, #16] ;load *dst_ptr from stack
|
||||
ldr r5, [sp, #20] ;load dst_pixels_per_line from stack
|
||||
ldr r6, [sp, #24] ;load *sse from stack
|
||||
@@ -405,8 +410,8 @@ sub_pixel_variance16x16_neon_loop
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [r6] ;store sse
|
||||
vshr.s32 d10, d10, #8
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #8
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
add sp, sp, #528
|
||||
vmov.32 r0, d0[0] ;return
|
||||
@@ -415,11 +420,4 @@ sub_pixel_variance16x16_neon_loop
|
||||
|
||||
ENDP
|
||||
|
||||
;-----------------
|
||||
|
||||
_BilinearTaps_coeff_
|
||||
DCD bilinear_taps_coeff
|
||||
bilinear_taps_coeff
|
||||
DCD 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
|
||||
|
||||
END
|
@@ -112,8 +112,8 @@ vp8_filt_fpo16x16s_4_0_loop_neon
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [lr] ;store sse
|
||||
vshr.s32 d10, d10, #8
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #8
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
pop {pc}
|
||||
@@ -208,8 +208,8 @@ vp8_filt_spo16x16s_0_4_loop_neon
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [lr] ;store sse
|
||||
vshr.s32 d10, d10, #8
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #8
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
pop {pc}
|
||||
@@ -327,8 +327,8 @@ vp8_filt16x16s_4_4_loop_neon
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [lr] ;store sse
|
||||
vshr.s32 d10, d10, #8
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #8
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
pop {pc}
|
||||
@@ -560,8 +560,8 @@ sub_pixel_variance16x16s_neon_loop
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [lr] ;store sse
|
||||
vshr.s32 d10, d10, #8
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #8
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
add sp, sp, #256
|
||||
vmov.32 r0, d0[0] ;return
|
@@ -27,7 +27,7 @@
|
||||
|vp8_sub_pixel_variance8x8_neon| PROC
|
||||
push {r4-r5, lr}
|
||||
|
||||
ldr r12, _BilinearTaps_coeff_
|
||||
adr r12, bilinear_taps_coeff
|
||||
ldr r4, [sp, #12] ;load *dst_ptr from stack
|
||||
ldr r5, [sp, #16] ;load dst_pixels_per_line from stack
|
||||
ldr lr, [sp, #20] ;load *sse from stack
|
||||
@@ -206,8 +206,8 @@ sub_pixel_variance8x8_neon_loop
|
||||
|
||||
vmull.s32 q5, d0, d0
|
||||
vst1.32 {d1[0]}, [lr] ;store sse
|
||||
vshr.s32 d10, d10, #6
|
||||
vsub.s32 d0, d1, d10
|
||||
vshr.u32 d10, d10, #6
|
||||
vsub.u32 d0, d1, d10
|
||||
|
||||
vmov.32 r0, d0[0] ;return
|
||||
pop {r4-r5, pc}
|
||||
@@ -216,8 +216,6 @@ sub_pixel_variance8x8_neon_loop
|
||||
|
||||
;-----------------
|
||||
|
||||
_BilinearTaps_coeff_
|
||||
DCD bilinear_taps_coeff
|
||||
bilinear_taps_coeff
|
||||
DCD 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
|
||||
|
@@ -1,65 +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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef RECON_ARM_H
|
||||
#define RECON_ARM_H
|
||||
|
||||
#if HAVE_ARMV6
|
||||
|
||||
extern prototype_copy_block(vp8_copy_mem8x8_v6);
|
||||
extern prototype_copy_block(vp8_copy_mem8x4_v6);
|
||||
extern prototype_copy_block(vp8_copy_mem16x16_v6);
|
||||
extern prototype_intra4x4_predict(vp8_intra4x4_predict_armv6);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_recon_copy8x8
|
||||
#define vp8_recon_copy8x8 vp8_copy_mem8x8_v6
|
||||
|
||||
#undef vp8_recon_copy8x4
|
||||
#define vp8_recon_copy8x4 vp8_copy_mem8x4_v6
|
||||
|
||||
#undef vp8_recon_copy16x16
|
||||
#define vp8_recon_copy16x16 vp8_copy_mem16x16_v6
|
||||
|
||||
#undef vp8_recon_intra4x4_predict
|
||||
#define vp8_recon_intra4x4_predict vp8_intra4x4_predict_armv6
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
|
||||
extern prototype_copy_block(vp8_copy_mem8x8_neon);
|
||||
extern prototype_copy_block(vp8_copy_mem8x4_neon);
|
||||
extern prototype_copy_block(vp8_copy_mem16x16_neon);
|
||||
|
||||
extern prototype_build_intra_predictors(vp8_build_intra_predictors_mby_neon);
|
||||
extern prototype_build_intra_predictors(vp8_build_intra_predictors_mby_s_neon);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_recon_copy8x8
|
||||
#define vp8_recon_copy8x8 vp8_copy_mem8x8_neon
|
||||
|
||||
#undef vp8_recon_copy8x4
|
||||
#define vp8_recon_copy8x4 vp8_copy_mem8x4_neon
|
||||
|
||||
#undef vp8_recon_copy16x16
|
||||
#define vp8_recon_copy16x16 vp8_copy_mem16x16_neon
|
||||
|
||||
#undef vp8_recon_build_intra_predictors_mby
|
||||
#define vp8_recon_build_intra_predictors_mby vp8_build_intra_predictors_mby_neon
|
||||
|
||||
#undef vp8_recon_build_intra_predictors_mby_s
|
||||
#define vp8_recon_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s_neon
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -10,12 +10,11 @@
|
||||
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
#include "vp8/common/reconintra.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vp8/common/recon.h"
|
||||
|
||||
#if HAVE_ARMV7
|
||||
#if HAVE_NEON
|
||||
extern void vp8_build_intra_predictors_mby_neon_func(
|
||||
unsigned char *y_buffer,
|
||||
unsigned char *ypred_ptr,
|
||||
@@ -35,10 +34,7 @@ void vp8_build_intra_predictors_mby_neon(MACROBLOCKD *x)
|
||||
|
||||
vp8_build_intra_predictors_mby_neon_func(y_buffer, ypred_ptr, y_stride, mode, Up, Left);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if HAVE_ARMV7
|
||||
extern void vp8_build_intra_predictors_mby_s_neon_func(
|
||||
unsigned char *y_buffer,
|
||||
unsigned char *ypred_ptr,
|
||||
|
@@ -1,89 +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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SUBPIXEL_ARM_H
|
||||
#define SUBPIXEL_ARM_H
|
||||
|
||||
#if HAVE_ARMV6
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict16x16_armv6);
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict8x8_armv6);
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict8x4_armv6);
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict_armv6);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict16x16_armv6);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict8x8_armv6);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict8x4_armv6);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict4x4_armv6);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_subpix_sixtap16x16
|
||||
#define vp8_subpix_sixtap16x16 vp8_sixtap_predict16x16_armv6
|
||||
|
||||
#undef vp8_subpix_sixtap8x8
|
||||
#define vp8_subpix_sixtap8x8 vp8_sixtap_predict8x8_armv6
|
||||
|
||||
#undef vp8_subpix_sixtap8x4
|
||||
#define vp8_subpix_sixtap8x4 vp8_sixtap_predict8x4_armv6
|
||||
|
||||
#undef vp8_subpix_sixtap4x4
|
||||
#define vp8_subpix_sixtap4x4 vp8_sixtap_predict_armv6
|
||||
|
||||
#undef vp8_subpix_bilinear16x16
|
||||
#define vp8_subpix_bilinear16x16 vp8_bilinear_predict16x16_armv6
|
||||
|
||||
#undef vp8_subpix_bilinear8x8
|
||||
#define vp8_subpix_bilinear8x8 vp8_bilinear_predict8x8_armv6
|
||||
|
||||
#undef vp8_subpix_bilinear8x4
|
||||
#define vp8_subpix_bilinear8x4 vp8_bilinear_predict8x4_armv6
|
||||
|
||||
#undef vp8_subpix_bilinear4x4
|
||||
#define vp8_subpix_bilinear4x4 vp8_bilinear_predict4x4_armv6
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict16x16_neon);
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict8x8_neon);
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict8x4_neon);
|
||||
extern prototype_subpixel_predict(vp8_sixtap_predict_neon);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict16x16_neon);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict8x8_neon);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict8x4_neon);
|
||||
extern prototype_subpixel_predict(vp8_bilinear_predict4x4_neon);
|
||||
|
||||
#if !CONFIG_RUNTIME_CPU_DETECT
|
||||
#undef vp8_subpix_sixtap16x16
|
||||
#define vp8_subpix_sixtap16x16 vp8_sixtap_predict16x16_neon
|
||||
|
||||
#undef vp8_subpix_sixtap8x8
|
||||
#define vp8_subpix_sixtap8x8 vp8_sixtap_predict8x8_neon
|
||||
|
||||
#undef vp8_subpix_sixtap8x4
|
||||
#define vp8_subpix_sixtap8x4 vp8_sixtap_predict8x4_neon
|
||||
|
||||
#undef vp8_subpix_sixtap4x4
|
||||
#define vp8_subpix_sixtap4x4 vp8_sixtap_predict_neon
|
||||
|
||||
#undef vp8_subpix_bilinear16x16
|
||||
#define vp8_subpix_bilinear16x16 vp8_bilinear_predict16x16_neon
|
||||
|
||||
#undef vp8_subpix_bilinear8x8
|
||||
#define vp8_subpix_bilinear8x8 vp8_bilinear_predict8x8_neon
|
||||
|
||||
#undef vp8_subpix_bilinear8x4
|
||||
#define vp8_subpix_bilinear8x4 vp8_bilinear_predict8x4_neon
|
||||
|
||||
#undef vp8_subpix_bilinear4x4
|
||||
#define vp8_subpix_bilinear4x4 vp8_bilinear_predict4x4_neon
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -9,10 +9,11 @@
|
||||
*/
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "vp8/encoder/variance.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include "vp8/common/variance.h"
|
||||
#include "vp8/common/filter.h"
|
||||
|
||||
#if HAVE_ARMV6
|
||||
#if HAVE_MEDIA
|
||||
#include "vp8/common/arm/bilinearfilter_arm.h"
|
||||
|
||||
unsigned int vp8_sub_pixel_variance8x8_armv6
|
||||
@@ -91,10 +92,21 @@ unsigned int vp8_sub_pixel_variance16x16_armv6
|
||||
return var;
|
||||
}
|
||||
|
||||
#endif /* HAVE_ARMV6 */
|
||||
#endif /* HAVE_MEDIA */
|
||||
|
||||
|
||||
#if HAVE_ARMV7
|
||||
#if HAVE_NEON
|
||||
|
||||
extern unsigned int vp8_sub_pixel_variance16x16_neon_func
|
||||
(
|
||||
const unsigned char *src_ptr,
|
||||
int src_pixels_per_line,
|
||||
int xoffset,
|
||||
int yoffset,
|
||||
const unsigned char *dst_ptr,
|
||||
int dst_pixels_per_line,
|
||||
unsigned int *sse
|
||||
);
|
||||
|
||||
unsigned int vp8_sub_pixel_variance16x16_neon
|
||||
(
|
@@ -15,6 +15,10 @@
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
|
||||
#if CONFIG_POSTPROC
|
||||
#include "postproc.h"
|
||||
#endif /* CONFIG_POSTPROC */
|
||||
|
||||
BEGIN
|
||||
|
||||
/* vpx_scale */
|
||||
@@ -30,12 +34,17 @@ DEFINE(yv12_buffer_config_v_buffer, offsetof(YV12_BUFFER_CONFIG, v_b
|
||||
DEFINE(yv12_buffer_config_border, offsetof(YV12_BUFFER_CONFIG, border));
|
||||
DEFINE(VP8BORDERINPIXELS_VAL, VP8BORDERINPIXELS);
|
||||
|
||||
#if CONFIG_POSTPROC
|
||||
/* mfqe.c / filter_by_weight */
|
||||
DEFINE(MFQE_PRECISION_VAL, MFQE_PRECISION);
|
||||
#endif /* CONFIG_POSTPROC */
|
||||
|
||||
END
|
||||
|
||||
/* add asserts for any offset that is not supported by assembly code */
|
||||
/* add asserts for any size that is not supported by assembly code */
|
||||
|
||||
#if HAVE_ARMV6
|
||||
#if HAVE_MEDIA
|
||||
/* switch case in vp8_intra4x4_predict_armv6 is based on these enumerated values */
|
||||
ct_assert(B_DC_PRED, B_DC_PRED == 0);
|
||||
ct_assert(B_TM_PRED, B_TM_PRED == 1);
|
||||
@@ -49,7 +58,14 @@ ct_assert(B_HD_PRED, B_HD_PRED == 8);
|
||||
ct_assert(B_HU_PRED, B_HU_PRED == 9);
|
||||
#endif
|
||||
|
||||
#if HAVE_ARMV7
|
||||
#if HAVE_NEON
|
||||
/* vp8_yv12_extend_frame_borders_neon makes several assumptions based on this */
|
||||
ct_assert(VP8BORDERINPIXELS_VAL, VP8BORDERINPIXELS == 32)
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE2
|
||||
#if CONFIG_POSTPROC
|
||||
/* vp8_filter_by_weight16x16 and 8x8 */
|
||||
ct_assert(MFQE_PRECISION_VAL, MFQE_PRECISION == 4)
|
||||
#endif /* CONFIG_POSTPROC */
|
||||
#endif /* HAVE_SSE2 */
|
||||
|
@@ -18,7 +18,6 @@ void vpx_log(const char *format, ...);
|
||||
#include "vpx_scale/yv12config.h"
|
||||
#include "mv.h"
|
||||
#include "treecoder.h"
|
||||
#include "subpixel.h"
|
||||
#include "vpx_ports/mem.h"
|
||||
|
||||
/*#define DCPRED 1*/
|
||||
@@ -151,56 +150,61 @@ typedef enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MB_PREDICTION_MODE mode, uv_mode;
|
||||
MV_REFERENCE_FRAME ref_frame;
|
||||
uint8_t mode, uv_mode;
|
||||
uint8_t ref_frame;
|
||||
uint8_t is_4x4;
|
||||
int_mv mv;
|
||||
|
||||
unsigned char partitioning;
|
||||
unsigned char mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
|
||||
unsigned char need_to_clamp_mvs;
|
||||
unsigned char segment_id; /* Which set of segmentation parameters should be used for this MB */
|
||||
uint8_t partitioning;
|
||||
uint8_t mb_skip_coeff; /* does this mb has coefficients at all, 1=no coefficients, 0=need decode tokens */
|
||||
uint8_t need_to_clamp_mvs;
|
||||
uint8_t segment_id; /* Which set of segmentation parameters should be used for this MB */
|
||||
} MB_MODE_INFO;
|
||||
|
||||
typedef struct
|
||||
typedef struct modeinfo
|
||||
{
|
||||
MB_MODE_INFO mbmi;
|
||||
union b_mode_info bmi[16];
|
||||
} MODE_INFO;
|
||||
|
||||
#if CONFIG_MULTI_RES_ENCODING
|
||||
/* The information needed to be stored for higher-resolution encoder */
|
||||
/* The mb-level information needed to be stored for higher-resolution encoder */
|
||||
typedef struct
|
||||
{
|
||||
MB_PREDICTION_MODE mode;
|
||||
MV_REFERENCE_FRAME ref_frame;
|
||||
int_mv mv;
|
||||
//union b_mode_info bmi[16];
|
||||
int dissim; // dissimilarity level of the macroblock
|
||||
} LOWER_RES_INFO;
|
||||
int dissim; /* dissimilarity level of the macroblock */
|
||||
} LOWER_RES_MB_INFO;
|
||||
|
||||
/* The frame-level information needed to be stored for higher-resolution
|
||||
* encoder */
|
||||
typedef struct
|
||||
{
|
||||
FRAME_TYPE frame_type;
|
||||
int is_frame_dropped;
|
||||
/* The frame number of each reference frames */
|
||||
unsigned int low_res_ref_frames[MAX_REF_FRAMES];
|
||||
LOWER_RES_MB_INFO *mb_info;
|
||||
} LOWER_RES_FRAME_INFO;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
typedef struct blockd
|
||||
{
|
||||
short *qcoeff;
|
||||
short *dqcoeff;
|
||||
unsigned char *predictor;
|
||||
short *dequant;
|
||||
|
||||
/* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */
|
||||
unsigned char **base_pre;
|
||||
int pre;
|
||||
int pre_stride;
|
||||
|
||||
unsigned char **base_dst;
|
||||
int dst;
|
||||
int dst_stride;
|
||||
|
||||
int offset;
|
||||
char *eob;
|
||||
|
||||
union b_mode_info bmi;
|
||||
} BLOCKD;
|
||||
|
||||
typedef struct MacroBlockD
|
||||
typedef void (*vp8_subpix_fn_t)(unsigned char *src, int src_pitch, int xofst, int yofst, unsigned char *dst, int dst_pitch);
|
||||
|
||||
typedef struct macroblockd
|
||||
{
|
||||
DECLARE_ALIGNED(16, unsigned char, predictor[384]);
|
||||
DECLARE_ALIGNED(16, short, qcoeff[400]);
|
||||
@@ -227,6 +231,10 @@ typedef struct MacroBlockD
|
||||
int up_available;
|
||||
int left_available;
|
||||
|
||||
unsigned char *recon_above[3];
|
||||
unsigned char *recon_left[3];
|
||||
int recon_left_stride[2];
|
||||
|
||||
/* Y,U,V,Y2 */
|
||||
ENTROPY_CONTEXT_PLANES *above_context;
|
||||
ENTROPY_CONTEXT_PLANES *left_context;
|
||||
@@ -265,11 +273,8 @@ typedef struct MacroBlockD
|
||||
int mb_to_top_edge;
|
||||
int mb_to_bottom_edge;
|
||||
|
||||
int ref_frame_cost[MAX_REF_FRAMES];
|
||||
|
||||
|
||||
unsigned int frames_since_golden;
|
||||
unsigned int frames_till_alt_ref_frame;
|
||||
vp8_subpix_fn_t subpixel_predict;
|
||||
vp8_subpix_fn_t subpixel_predict8x4;
|
||||
vp8_subpix_fn_t subpixel_predict8x8;
|
||||
@@ -286,10 +291,6 @@ typedef struct MacroBlockD
|
||||
*/
|
||||
DECLARE_ALIGNED(32, unsigned char, y_buf[22*32]);
|
||||
#endif
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
struct VP8_COMMON_RTCD *rtcd;
|
||||
#endif
|
||||
} MACROBLOCKD;
|
||||
|
||||
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
|
||||
#include "vpx_config.h"
|
||||
#include "dequantize.h"
|
||||
#include "vp8/common/idct.h"
|
||||
#include "vpx_rtcd.h"
|
||||
#include "vp8/common/blockd.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
void vp8_dequantize_b_c(BLOCKD *d, short *DQC)
|
||||
|
@@ -1,85 +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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DEQUANTIZE_H
|
||||
#define DEQUANTIZE_H
|
||||
#include "vp8/common/blockd.h"
|
||||
|
||||
#define prototype_dequant_block(sym) \
|
||||
void sym(BLOCKD *x, short *DQC)
|
||||
|
||||
#define prototype_dequant_idct_add(sym) \
|
||||
void sym(short *input, short *dq, \
|
||||
unsigned char *output, \
|
||||
int stride)
|
||||
|
||||
#define prototype_dequant_idct_add_y_block(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *dst, \
|
||||
int stride, char *eobs)
|
||||
|
||||
#define prototype_dequant_idct_add_uv_block(sym) \
|
||||
void sym(short *q, short *dq, \
|
||||
unsigned char *dst_u, \
|
||||
unsigned char *dst_v, int stride, char *eobs)
|
||||
|
||||
#if ARCH_X86 || ARCH_X86_64
|
||||
#include "x86/dequantize_x86.h"
|
||||
#endif
|
||||
|
||||
#if ARCH_ARM
|
||||
#include "arm/dequantize_arm.h"
|
||||
#endif
|
||||
|
||||
#ifndef vp8_dequant_block
|
||||
#define vp8_dequant_block vp8_dequantize_b_c
|
||||
#endif
|
||||
extern prototype_dequant_block(vp8_dequant_block);
|
||||
|
||||
#ifndef vp8_dequant_idct_add
|
||||
#define vp8_dequant_idct_add vp8_dequant_idct_add_c
|
||||
#endif
|
||||
extern prototype_dequant_idct_add(vp8_dequant_idct_add);
|
||||
|
||||
#ifndef vp8_dequant_idct_add_y_block
|
||||
#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_c
|
||||
#endif
|
||||
extern prototype_dequant_idct_add_y_block(vp8_dequant_idct_add_y_block);
|
||||
|
||||
#ifndef vp8_dequant_idct_add_uv_block
|
||||
#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_c
|
||||
#endif
|
||||
extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block);
|
||||
|
||||
|
||||
typedef prototype_dequant_block((*vp8_dequant_block_fn_t));
|
||||
|
||||
typedef prototype_dequant_idct_add((*vp8_dequant_idct_add_fn_t));
|
||||
|
||||
typedef prototype_dequant_idct_add_y_block((*vp8_dequant_idct_add_y_block_fn_t));
|
||||
|
||||
typedef prototype_dequant_idct_add_uv_block((*vp8_dequant_idct_add_uv_block_fn_t));
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vp8_dequant_block_fn_t block;
|
||||
vp8_dequant_idct_add_fn_t idct_add;
|
||||
vp8_dequant_idct_add_y_block_fn_t idct_add_y_block;
|
||||
vp8_dequant_idct_add_uv_block_fn_t idct_add_uv_block;
|
||||
} vp8_dequant_rtcd_vtable_t;
|
||||
|
||||
#if CONFIG_RUNTIME_CPU_DETECT
|
||||
#define DEQUANT_INVOKE(ctx,fn) (ctx)->fn
|
||||
#else
|
||||
#define DEQUANT_INVOKE(ctx,fn) vp8_dequant_##fn
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -8,23 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "entropy.h"
|
||||
#include "string.h"
|
||||
#include "blockd.h"
|
||||
#include "onyxc_int.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
#define uchar unsigned char /* typedefs can clash */
|
||||
#define uint unsigned int
|
||||
|
||||
typedef const uchar cuchar;
|
||||
typedef const uint cuint;
|
||||
|
||||
typedef vp8_prob Prob;
|
||||
|
||||
#include "coefupdateprobs.h"
|
||||
|
||||
DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) =
|
||||
@@ -47,10 +35,11 @@ DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) =
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, cuchar, vp8_coef_bands[16]) =
|
||||
DECLARE_ALIGNED(16, const unsigned char, vp8_coef_bands[16]) =
|
||||
{ 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7};
|
||||
|
||||
DECLARE_ALIGNED(16, cuchar, vp8_prev_token_class[MAX_ENTROPY_TOKENS]) =
|
||||
DECLARE_ALIGNED(16, const unsigned char,
|
||||
vp8_prev_token_class[MAX_ENTROPY_TOKENS]) =
|
||||
{ 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0};
|
||||
|
||||
DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) =
|
||||
@@ -69,7 +58,26 @@ DECLARE_ALIGNED(16, const short, vp8_default_inv_zig_zag[16]) =
|
||||
10, 11, 15, 16
|
||||
};
|
||||
|
||||
DECLARE_ALIGNED(16, short, vp8_default_zig_zag_mask[16]);
|
||||
/* vp8_default_zig_zag_mask generated with:
|
||||
|
||||
void vp8_init_scan_order_mask()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
vp8_default_zig_zag_mask[vp8_default_zig_zag1d[i]] = 1 << i;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
DECLARE_ALIGNED(16, const short, vp8_default_zig_zag_mask[16]) =
|
||||
{
|
||||
1, 2, 32, 64,
|
||||
4, 16, 128, 4096,
|
||||
8, 256, 2048, 8192,
|
||||
512, 1024, 16384, -32768
|
||||
};
|
||||
|
||||
const int vp8_mb_feature_data_bits[MB_LVL_MAX] = {7, 6};
|
||||
|
||||
@@ -90,56 +98,72 @@ const vp8_tree_index vp8_coef_tree[ 22] = /* corresponding _CONTEXT_NODEs */
|
||||
-DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6 /* 10 = CAT_FIVE */
|
||||
};
|
||||
|
||||
struct vp8_token_struct vp8_coef_encodings[MAX_ENTROPY_TOKENS];
|
||||
/* vp8_coef_encodings generated with:
|
||||
vp8_tokens_from_tree(vp8_coef_encodings, vp8_coef_tree);
|
||||
*/
|
||||
vp8_token vp8_coef_encodings[MAX_ENTROPY_TOKENS] =
|
||||
{
|
||||
{2, 2},
|
||||
{6, 3},
|
||||
{28, 5},
|
||||
{58, 6},
|
||||
{59, 6},
|
||||
{60, 6},
|
||||
{61, 6},
|
||||
{124, 7},
|
||||
{125, 7},
|
||||
{126, 7},
|
||||
{127, 7},
|
||||
{0, 1}
|
||||
};
|
||||
|
||||
/* Trees for extra bits. Probabilities are constant and
|
||||
do not depend on previously encoded bits */
|
||||
|
||||
static const Prob Pcat1[] = { 159};
|
||||
static const Prob Pcat2[] = { 165, 145};
|
||||
static const Prob Pcat3[] = { 173, 148, 140};
|
||||
static const Prob Pcat4[] = { 176, 155, 140, 135};
|
||||
static const Prob Pcat5[] = { 180, 157, 141, 134, 130};
|
||||
static const Prob Pcat6[] =
|
||||
static const vp8_prob Pcat1[] = { 159};
|
||||
static const vp8_prob Pcat2[] = { 165, 145};
|
||||
static const vp8_prob Pcat3[] = { 173, 148, 140};
|
||||
static const vp8_prob Pcat4[] = { 176, 155, 140, 135};
|
||||
static const vp8_prob Pcat5[] = { 180, 157, 141, 134, 130};
|
||||
static const vp8_prob Pcat6[] =
|
||||
{ 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129};
|
||||
|
||||
static vp8_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[22];
|
||||
|
||||
void vp8_init_scan_order_mask()
|
||||
{
|
||||
int i;
|
||||
/* tree index tables generated with:
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
void init_bit_tree(vp8_tree_index *p, int n)
|
||||
{
|
||||
vp8_default_zig_zag_mask[vp8_default_zig_zag1d[i]] = 1 << i;
|
||||
int i = 0;
|
||||
|
||||
while (++i < n)
|
||||
{
|
||||
p[0] = p[1] = i << 1;
|
||||
p += 2;
|
||||
}
|
||||
|
||||
p[0] = p[1] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void init_bit_tree(vp8_tree_index *p, int n)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (++i < n)
|
||||
void init_bit_trees()
|
||||
{
|
||||
p[0] = p[1] = i << 1;
|
||||
p += 2;
|
||||
init_bit_tree(cat1, 1);
|
||||
init_bit_tree(cat2, 2);
|
||||
init_bit_tree(cat3, 3);
|
||||
init_bit_tree(cat4, 4);
|
||||
init_bit_tree(cat5, 5);
|
||||
init_bit_tree(cat6, 11);
|
||||
}
|
||||
*/
|
||||
|
||||
p[0] = p[1] = 0;
|
||||
}
|
||||
static const vp8_tree_index cat1[2] = { 0, 0 };
|
||||
static const vp8_tree_index cat2[4] = { 2, 2, 0, 0 };
|
||||
static const vp8_tree_index cat3[6] = { 2, 2, 4, 4, 0, 0 };
|
||||
static const vp8_tree_index cat4[8] = { 2, 2, 4, 4, 6, 6, 0, 0 };
|
||||
static const vp8_tree_index cat5[10] = { 2, 2, 4, 4, 6, 6, 8, 8, 0, 0 };
|
||||
static const vp8_tree_index cat6[22] = { 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12,
|
||||
14, 14, 16, 16, 18, 18, 20, 20, 0, 0 };
|
||||
|
||||
static void init_bit_trees()
|
||||
{
|
||||
init_bit_tree(cat1, 1);
|
||||
init_bit_tree(cat2, 2);
|
||||
init_bit_tree(cat3, 3);
|
||||
init_bit_tree(cat4, 4);
|
||||
init_bit_tree(cat5, 5);
|
||||
init_bit_tree(cat6, 11);
|
||||
}
|
||||
|
||||
vp8_extra_bit_struct vp8_extra_bits[12] =
|
||||
const vp8_extra_bit_struct vp8_extra_bits[12] =
|
||||
{
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 1},
|
||||
@@ -163,8 +187,3 @@ void vp8_default_coef_probs(VP8_COMMON *pc)
|
||||
sizeof(default_coef_probs));
|
||||
}
|
||||
|
||||
void vp8_coef_tree_initialize()
|
||||
{
|
||||
init_bit_trees();
|
||||
vp8_tokens_from_tree(vp8_coef_encodings, vp8_coef_tree);
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
extern const vp8_tree_index vp8_coef_tree[];
|
||||
|
||||
extern struct vp8_token_struct vp8_coef_encodings[MAX_ENTROPY_TOKENS];
|
||||
extern const struct vp8_token_struct vp8_coef_encodings[MAX_ENTROPY_TOKENS];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -45,7 +45,7 @@ typedef struct
|
||||
int base_val;
|
||||
} vp8_extra_bit_struct;
|
||||
|
||||
extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
|
||||
extern const vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */
|
||||
|
||||
#define PROB_UPDATE_BASELINE_COST 7
|
||||
|
||||
@@ -94,7 +94,7 @@ void vp8_default_coef_probs(struct VP8Common *);
|
||||
|
||||
extern DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]);
|
||||
extern DECLARE_ALIGNED(16, const short, vp8_default_inv_zig_zag[16]);
|
||||
extern short vp8_default_zig_zag_mask[16];
|
||||
extern DECLARE_ALIGNED(16, const short, vp8_default_zig_zag_mask[16]);
|
||||
extern const int vp8_mb_feature_data_bits[MB_LVL_MAX];
|
||||
|
||||
void vp8_coef_tree_initialize(void);
|
||||
|
@@ -8,22 +8,13 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#define USE_PREBUILT_TABLES
|
||||
|
||||
#include "entropymode.h"
|
||||
#include "entropy.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
|
||||
static const unsigned int kf_y_mode_cts[VP8_YMODES] = { 1607, 915, 812, 811, 5455};
|
||||
static const unsigned int y_mode_cts [VP8_YMODES] = { 8080, 1908, 1582, 1007, 5874};
|
||||
|
||||
static const unsigned int uv_mode_cts [VP8_UV_MODES] = { 59483, 13605, 16492, 4230};
|
||||
static const unsigned int kf_uv_mode_cts[VP8_UV_MODES] = { 5319, 1904, 1703, 674};
|
||||
|
||||
static const unsigned int bmode_cts[VP8_BINTRAMODES] =
|
||||
{
|
||||
43891, 17694, 10036, 3920, 3363, 2546, 5119, 3221, 2471, 1723
|
||||
};
|
||||
|
||||
#include "vp8_entropymodedata.h"
|
||||
|
||||
int vp8_mv_cont(const int_mv *l, const int_mv *a)
|
||||
{
|
||||
@@ -59,7 +50,7 @@ const vp8_prob vp8_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS-1] =
|
||||
|
||||
|
||||
|
||||
vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS] =
|
||||
const vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS] =
|
||||
{
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
@@ -84,7 +75,7 @@ vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS] =
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const int vp8_mbsplit_count [VP8_NUMMBSPLITS] = { 2, 2, 4, 16};
|
||||
@@ -155,17 +146,6 @@ const vp8_tree_index vp8_sub_mv_ref_tree[6] =
|
||||
-ZERO4X4, -NEW4X4
|
||||
};
|
||||
|
||||
|
||||
struct vp8_token_struct vp8_bmode_encodings [VP8_BINTRAMODES];
|
||||
struct vp8_token_struct vp8_ymode_encodings [VP8_YMODES];
|
||||
struct vp8_token_struct vp8_kf_ymode_encodings [VP8_YMODES];
|
||||
struct vp8_token_struct vp8_uv_mode_encodings [VP8_UV_MODES];
|
||||
struct vp8_token_struct vp8_mbsplit_encodings [VP8_NUMMBSPLITS];
|
||||
|
||||
struct vp8_token_struct vp8_mv_ref_encoding_array [VP8_MVREFS];
|
||||
struct vp8_token_struct vp8_sub_mv_ref_encoding_array [VP8_SUBMVREFS];
|
||||
|
||||
|
||||
const vp8_tree_index vp8_small_mvtree [14] =
|
||||
{
|
||||
2, 8,
|
||||
@@ -177,89 +157,15 @@ const vp8_tree_index vp8_small_mvtree [14] =
|
||||
-6, -7
|
||||
};
|
||||
|
||||
struct vp8_token_struct vp8_small_mvencodings [8];
|
||||
|
||||
void vp8_init_mbmode_probs(VP8_COMMON *x)
|
||||
{
|
||||
unsigned int bct [VP8_YMODES] [2]; /* num Ymodes > num UV modes */
|
||||
|
||||
vp8_tree_probs_from_distribution(
|
||||
VP8_YMODES, vp8_ymode_encodings, vp8_ymode_tree,
|
||||
x->fc.ymode_prob, bct, y_mode_cts,
|
||||
256, 1
|
||||
);
|
||||
vp8_tree_probs_from_distribution(
|
||||
VP8_YMODES, vp8_kf_ymode_encodings, vp8_kf_ymode_tree,
|
||||
x->kf_ymode_prob, bct, kf_y_mode_cts,
|
||||
256, 1
|
||||
);
|
||||
vp8_tree_probs_from_distribution(
|
||||
VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
|
||||
x->fc.uv_mode_prob, bct, uv_mode_cts,
|
||||
256, 1
|
||||
);
|
||||
vp8_tree_probs_from_distribution(
|
||||
VP8_UV_MODES, vp8_uv_mode_encodings, vp8_uv_mode_tree,
|
||||
x->kf_uv_mode_prob, bct, kf_uv_mode_cts,
|
||||
256, 1
|
||||
);
|
||||
vpx_memcpy(x->fc.ymode_prob, vp8_ymode_prob, sizeof(vp8_ymode_prob));
|
||||
vpx_memcpy(x->fc.uv_mode_prob, vp8_uv_mode_prob, sizeof(vp8_uv_mode_prob));
|
||||
vpx_memcpy(x->fc.sub_mv_ref_prob, sub_mv_ref_prob, sizeof(sub_mv_ref_prob));
|
||||
}
|
||||
|
||||
|
||||
static void intra_bmode_probs_from_distribution(
|
||||
vp8_prob p [VP8_BINTRAMODES-1],
|
||||
unsigned int branch_ct [VP8_BINTRAMODES-1] [2],
|
||||
const unsigned int events [VP8_BINTRAMODES]
|
||||
)
|
||||
{
|
||||
vp8_tree_probs_from_distribution(
|
||||
VP8_BINTRAMODES, vp8_bmode_encodings, vp8_bmode_tree,
|
||||
p, branch_ct, events,
|
||||
256, 1
|
||||
);
|
||||
}
|
||||
|
||||
void vp8_default_bmode_probs(vp8_prob p [VP8_BINTRAMODES-1])
|
||||
{
|
||||
unsigned int branch_ct [VP8_BINTRAMODES-1] [2];
|
||||
intra_bmode_probs_from_distribution(p, branch_ct, bmode_cts);
|
||||
vpx_memcpy(p, vp8_bmode_prob, sizeof(vp8_bmode_prob));
|
||||
}
|
||||
|
||||
void vp8_kf_default_bmode_probs(vp8_prob p [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1])
|
||||
{
|
||||
unsigned int branch_ct [VP8_BINTRAMODES-1] [2];
|
||||
|
||||
int i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
int j = 0;
|
||||
|
||||
do
|
||||
{
|
||||
intra_bmode_probs_from_distribution(
|
||||
p[i][j], branch_ct, vp8_kf_default_bmode_counts[i][j]);
|
||||
|
||||
}
|
||||
while (++j < VP8_BINTRAMODES);
|
||||
}
|
||||
while (++i < VP8_BINTRAMODES);
|
||||
}
|
||||
|
||||
|
||||
void vp8_entropy_mode_init()
|
||||
{
|
||||
vp8_tokens_from_tree(vp8_bmode_encodings, vp8_bmode_tree);
|
||||
vp8_tokens_from_tree(vp8_ymode_encodings, vp8_ymode_tree);
|
||||
vp8_tokens_from_tree(vp8_kf_ymode_encodings, vp8_kf_ymode_tree);
|
||||
vp8_tokens_from_tree(vp8_uv_mode_encodings, vp8_uv_mode_tree);
|
||||
vp8_tokens_from_tree(vp8_mbsplit_encodings, vp8_mbsplit_tree);
|
||||
|
||||
vp8_tokens_from_tree_offset(vp8_mv_ref_encoding_array,
|
||||
vp8_mv_ref_tree, NEARESTMV);
|
||||
vp8_tokens_from_tree_offset(vp8_sub_mv_ref_encoding_array,
|
||||
vp8_sub_mv_ref_tree, LEFT4X4);
|
||||
|
||||
vp8_tokens_from_tree(vp8_small_mvencodings, vp8_small_mvtree);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user