Compare commits
593 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4bc7c1ba8e | ||
![]() |
0efb4ff86c | ||
![]() |
f0bb0aaaa7 | ||
![]() |
eb3330b050 | ||
![]() |
e31e66948d | ||
![]() |
835bc39b26 | ||
![]() |
bb81b2b2e0 | ||
![]() |
58287d3b10 | ||
![]() |
2a7bdbf67e | ||
![]() |
653cdf42ee | ||
![]() |
829e43017f | ||
![]() |
8d14e1d64e | ||
![]() |
5da68aff96 | ||
![]() |
55aedd679a | ||
![]() |
af26185bdc | ||
![]() |
af1fb1d467 | ||
![]() |
a9fc88ea93 | ||
![]() |
23e4284160 | ||
![]() |
42c7ed49a9 | ||
![]() |
494f2d4f9e | ||
![]() |
9597807ab1 | ||
![]() |
99fe4c577f | ||
![]() |
98e1f0a2db | ||
![]() |
3ee5458aa8 | ||
![]() |
99f953b3fe | ||
![]() |
9b9aee27f4 | ||
![]() |
7e350b7ddd | ||
![]() |
fc4d11ec9b | ||
![]() |
f06e39fe6b | ||
![]() |
fd2ba1807e | ||
![]() |
3ac156b707 | ||
![]() |
09ace619d6 | ||
![]() |
145de32896 | ||
![]() |
812955a12b | ||
![]() |
a63e83cd4b | ||
![]() |
c10f3fed25 | ||
![]() |
04d2f9ace3 | ||
![]() |
10f384e4f5 | ||
![]() |
78aa2ed620 | ||
![]() |
ad1223d6bc | ||
![]() |
a89868d714 | ||
![]() |
607863acae | ||
![]() |
2ff935a060 | ||
![]() |
2e4c649b3e | ||
![]() |
60701469ab | ||
![]() |
4d60ab62e0 | ||
![]() |
8bd27a167b | ||
![]() |
17e7edf75b | ||
![]() |
a6a8f66608 | ||
![]() |
b62704891d | ||
![]() |
0c8c6b4419 | ||
![]() |
97b6916f93 | ||
![]() |
ce1dacb435 | ||
![]() |
78dc022f6f | ||
![]() |
5379c5184b | ||
![]() |
4d90550cf9 | ||
![]() |
bacf5db196 | ||
![]() |
5358f1b507 | ||
![]() |
de75bc01cd | ||
![]() |
0b0f1cd44e | ||
![]() |
00516b5491 | ||
![]() |
3706c22992 | ||
![]() |
eac1c3f384 | ||
![]() |
163196562f | ||
![]() |
2e12af4587 | ||
![]() |
20c8f17629 | ||
![]() |
c8c93795e4 | ||
![]() |
38bd229af9 | ||
![]() |
fe8bc7d1ee | ||
![]() |
9f7a8b8f8f | ||
![]() |
9272aa4698 | ||
![]() |
aeca97a7b5 | ||
![]() |
b4c479a82a | ||
![]() |
9f883e75e6 | ||
![]() |
e47543eda5 | ||
![]() |
153deed18b | ||
![]() |
9eba02d5dd | ||
![]() |
557df77eab | ||
![]() |
f8a72f041c | ||
![]() |
9e505065b5 | ||
![]() |
eba112b4e3 | ||
![]() |
d411f07751 | ||
![]() |
8484351749 | ||
![]() |
01a58b439d | ||
![]() |
47bb4d888e | ||
![]() |
057f655dc6 | ||
![]() |
3bd0cd2677 | ||
![]() |
a4acb5b900 | ||
![]() |
c42fd4c6ee | ||
![]() |
3eee21406a | ||
![]() |
852ee0e0ad | ||
![]() |
ed2c15eadc | ||
![]() |
4ad0330b3d | ||
![]() |
9fde820d8e | ||
![]() |
b5e2ef771d | ||
![]() |
63e370b2cf | ||
![]() |
af225c41d4 | ||
![]() |
bf31271478 | ||
![]() |
8715ca0b82 | ||
![]() |
4d073ddac9 | ||
![]() |
007f3f4165 | ||
![]() |
6d2e3efd7c | ||
![]() |
fbbd6317e2 | ||
![]() |
87908de715 | ||
![]() |
de5e003369 | ||
![]() |
5c6aea5c31 | ||
![]() |
dfe0ba46bf | ||
![]() |
6bfa823b70 | ||
![]() |
701543a081 | ||
![]() |
580418bd55 | ||
![]() |
777bc81a91 | ||
![]() |
1e9e311e21 | ||
![]() |
0eb465f981 | ||
![]() |
b01e4d80c6 | ||
![]() |
68c9904669 | ||
![]() |
790606cfe9 | ||
![]() |
7b9bcd993c | ||
![]() |
aade60ab16 | ||
![]() |
3d91117df0 | ||
![]() |
9486e98712 | ||
![]() |
f3c7e604fa | ||
![]() |
4cb3efc206 | ||
![]() |
1e9d234c0c | ||
![]() |
8dc4b2c92e | ||
![]() |
251b4655be | ||
![]() |
1a65ce923a | ||
![]() |
b438451b7e | ||
![]() |
f1f8c0e558 | ||
![]() |
c93874c3a8 | ||
![]() |
e27fab0e6e | ||
![]() |
f743c4ece8 | ||
![]() |
86bf0a8871 | ||
![]() |
558d0b9483 | ||
![]() |
f78a3868fd | ||
![]() |
df2fc63543 | ||
![]() |
890c36d7ff | ||
![]() |
a2e7fd406c | ||
![]() |
7043e435dd | ||
![]() |
f7fcd40e63 | ||
![]() |
b7a4b4c145 | ||
![]() |
de1609bc2d | ||
![]() |
bd055c1768 | ||
![]() |
2892b01227 | ||
![]() |
e4a49ae561 | ||
![]() |
1feef46b90 | ||
![]() |
19382a2a10 | ||
![]() |
57588cda7b | ||
![]() |
e5162b3bc9 | ||
![]() |
ee9a440f49 | ||
![]() |
5582cfd0e4 | ||
![]() |
68c9f5cf64 | ||
![]() |
e36a005749 | ||
![]() |
9fb9419b02 | ||
![]() |
23633f4925 | ||
![]() |
be5fef6e0d | ||
![]() |
e3e5779a04 | ||
![]() |
46ecbef251 | ||
![]() |
528dd54d15 | ||
![]() |
ccdeedf22c | ||
![]() |
5c0dff6c60 | ||
![]() |
856bdcd5bc | ||
![]() |
a5fe40f728 | ||
![]() |
359bfa4c27 | ||
![]() |
bb263cc33a | ||
![]() |
f508bf7ff1 | ||
![]() |
898c51a016 | ||
![]() |
7fe88bc66c | ||
![]() |
333e708520 | ||
![]() |
0930a562e7 | ||
![]() |
fd85d03162 | ||
![]() |
26605efed7 | ||
![]() |
a32bbe54e4 | ||
![]() |
07bfb254c6 | ||
![]() |
9b89041a86 | ||
![]() |
09fcc2f865 | ||
![]() |
847d3225a8 | ||
![]() |
465742bbbe | ||
![]() |
40b8e7f168 | ||
![]() |
77783c7114 | ||
![]() |
979f97a861 | ||
![]() |
1b16302e54 | ||
![]() |
cbc6ded5b7 | ||
![]() |
93fbabb60f | ||
![]() |
a14ff5b256 | ||
![]() |
7c30ea5006 | ||
![]() |
e2d32ad18e | ||
![]() |
cea1769fb6 | ||
![]() |
082e3fd469 | ||
![]() |
747c320a19 | ||
![]() |
cf6a34b2a5 | ||
![]() |
6537f57782 | ||
![]() |
c92e37c207 | ||
![]() |
dd923878e8 | ||
![]() |
e897e0631a | ||
![]() |
b26c9f4e52 | ||
![]() |
937cedd7c0 | ||
![]() |
c5ba226c1b | ||
![]() |
cb31b6ca72 | ||
![]() |
b53db58ab7 | ||
![]() |
d0323b6234 | ||
![]() |
d502bd7410 | ||
![]() |
97e6099c0c | ||
![]() |
0b6adcf76b | ||
![]() |
116aa30db4 | ||
![]() |
e6cf47ee9e | ||
![]() |
f8602ef717 | ||
![]() |
a5bdec1c75 | ||
![]() |
dcbfba3bb6 | ||
![]() |
068bc633f2 | ||
![]() |
95275723ae | ||
![]() |
47cb05d783 | ||
![]() |
dc556d8bf7 | ||
![]() |
fbbe487b1c | ||
![]() |
7e9debb083 | ||
![]() |
256d615383 | ||
![]() |
9680f84a31 | ||
![]() |
505415b985 | ||
![]() |
d55f7a174d | ||
![]() |
cf738340d0 | ||
![]() |
861526bbd1 | ||
![]() |
7514868cb0 | ||
![]() |
4ec5c35850 | ||
![]() |
be71990da6 | ||
![]() |
99d82a07e7 | ||
![]() |
96f9b18497 | ||
![]() |
c03533ace2 | ||
![]() |
423ce8830e | ||
![]() |
5e46ad33eb | ||
![]() |
cbc1212499 | ||
![]() |
64867f3cb5 | ||
![]() |
d6a65735f9 | ||
![]() |
c4e2758eec | ||
![]() |
9f1c3cd5ad | ||
![]() |
160910acdb | ||
![]() |
c02d4c1a98 | ||
![]() |
6d2a92c467 | ||
![]() |
aa99cb15f6 | ||
![]() |
67a8a1c202 | ||
![]() |
8f3fe7c696 | ||
![]() |
64bcb5d350 | ||
![]() |
998a0389d3 | ||
![]() |
86eec54c94 | ||
![]() |
e7800543fe | ||
![]() |
fb1823e178 | ||
![]() |
a747cf8873 | ||
![]() |
002ca3e099 | ||
![]() |
fa6eef4210 | ||
![]() |
daa809fd9f | ||
![]() |
6124a7edbc | ||
![]() |
cb51d9ed25 | ||
![]() |
3f5824aa18 | ||
![]() |
a1ce54ce6a | ||
![]() |
ef81f55ec7 | ||
![]() |
c2c9b7297f | ||
![]() |
a1ac3c2d9c | ||
![]() |
ae72abf652 | ||
![]() |
9260710739 | ||
![]() |
b0558cd011 | ||
![]() |
0f84286677 | ||
![]() |
18900381e2 | ||
![]() |
944c47166d | ||
![]() |
86a816902f | ||
![]() |
8695d814e1 | ||
![]() |
ce74b92c09 | ||
![]() |
ba8d684622 | ||
![]() |
25ed0f05fd | ||
![]() |
b186a5d08c | ||
![]() |
af95e174c5 | ||
![]() |
93fc80f8bf | ||
![]() |
9aaca159bd | ||
![]() |
258eea3f2e | ||
![]() |
1c2bd6fe5f | ||
![]() |
73d5d7acb0 | ||
![]() |
80d73b4ada | ||
![]() |
b9892e1813 | ||
![]() |
d76480e6ba | ||
![]() |
33388299fb | ||
![]() |
d8dab6c3b8 | ||
![]() |
c8fb5d0f38 | ||
![]() |
5f7944a308 | ||
![]() |
f518fa6bee | ||
![]() |
51a23b0e95 | ||
![]() |
5c54fc6195 | ||
![]() |
2cdc976320 | ||
![]() |
efcfd50c9f | ||
![]() |
8bd0372937 | ||
![]() |
9761abffb6 | ||
![]() |
fbeae4a951 | ||
![]() |
88433979c2 | ||
![]() |
9d1b173aae | ||
![]() |
c7934c6c0b | ||
![]() |
04c29196ad | ||
![]() |
e2dcc4452d | ||
![]() |
24dc6b1a06 | ||
![]() |
d8e76a531c | ||
![]() |
2cfdf732ef | ||
![]() |
8268c1fea8 | ||
![]() |
d9a91dfb54 | ||
![]() |
5d2e4c918f | ||
![]() |
7e326d52a7 | ||
![]() |
71b8ef938c | ||
![]() |
5e6122ddad | ||
![]() |
1a0cdd18b0 | ||
![]() |
d33b0f7224 | ||
![]() |
6ddc1eb037 | ||
![]() |
ded74ab5d1 | ||
![]() |
f82e9deec2 | ||
![]() |
d0cabcc789 | ||
![]() |
dac0d4f354 | ||
![]() |
3f71c0c1b0 | ||
![]() |
ea56f6e5a7 | ||
![]() |
9ac3c6c2c6 | ||
![]() |
04c506e912 | ||
![]() |
bc4dc32b2a | ||
![]() |
01580c0955 | ||
![]() |
8eb7c2566c | ||
![]() |
042b8c2f06 | ||
![]() |
2fae70db2a | ||
![]() |
f08b0ff051 | ||
![]() |
f86b2e4f49 | ||
![]() |
d6373f1586 | ||
![]() |
2a39548181 | ||
![]() |
4c052a7b8b | ||
![]() |
30394adc44 | ||
![]() |
f908e3ce92 | ||
![]() |
683cbbb721 | ||
![]() |
cff8d01e15 | ||
![]() |
8c118207ea | ||
![]() |
406632d1ef | ||
![]() |
c320f9f5e9 | ||
![]() |
5fed47b94f | ||
![]() |
5a01ab0e62 | ||
![]() |
dbaf3f7b0b | ||
![]() |
4f6fbe47a9 | ||
![]() |
7251de3032 | ||
![]() |
5ba83e9091 | ||
![]() |
93fbf034c9 | ||
![]() |
10f77c165c | ||
![]() |
5a8dcc993d | ||
![]() |
aed12df7fe | ||
![]() |
7923a25fdd | ||
![]() |
510a96a211 | ||
![]() |
0af5a774eb | ||
![]() |
aaeef7fa0d | ||
![]() |
c340319559 | ||
![]() |
582aec4989 | ||
![]() |
2c23237cb4 | ||
![]() |
9eecf633f7 | ||
![]() |
7f451cb01f | ||
![]() |
a987750267 | ||
![]() |
2416eff5b9 | ||
![]() |
414c6bf094 | ||
![]() |
6f585f1e66 | ||
![]() |
85277ff936 | ||
![]() |
f544553c29 | ||
![]() |
51ee51b5eb | ||
![]() |
2e00dd4d62 | ||
![]() |
91138821fb | ||
![]() |
a4681d1043 | ||
![]() |
151c2ca8c7 | ||
![]() |
dafd8228bc | ||
![]() |
d9ab7c6292 | ||
![]() |
426715ccbd | ||
![]() |
a4e3bb0106 | ||
![]() |
cd2d8aca84 | ||
![]() |
e9d9fd1137 | ||
![]() |
e4bae0a140 | ||
![]() |
520c3d2303 | ||
![]() |
82a627c2c3 | ||
![]() |
0cb4887b83 | ||
![]() |
4a45535836 | ||
![]() |
4427e96bb1 | ||
![]() |
731f4bb6fd | ||
![]() |
898ce4d6e2 | ||
![]() |
93f80cf2cc | ||
![]() |
204c8798a8 | ||
![]() |
9767d7513c | ||
![]() |
d2b9da2f37 | ||
![]() |
395538e073 | ||
![]() |
a367ab657f | ||
![]() |
63235b8d41 | ||
![]() |
5353bd0285 | ||
![]() |
065996b984 | ||
![]() |
1ace588f4a | ||
![]() |
50a3442120 | ||
![]() |
008ae91bcc | ||
![]() |
82c3792a30 | ||
![]() |
1fa37f2bfa | ||
![]() |
d2d38531d6 | ||
![]() |
600bc1deba | ||
![]() |
77a2f4cbcf | ||
![]() |
7f8b55b560 | ||
![]() |
1ab4578c88 | ||
![]() |
52ab9e8984 | ||
![]() |
2922ab7e6f | ||
![]() |
5772cbb343 | ||
![]() |
46e1d05991 | ||
![]() |
a6f7fc8f3b | ||
![]() |
0662967d2b | ||
![]() |
ddeb6eeeb1 | ||
![]() |
5aac081110 | ||
![]() |
d8745de6ae | ||
![]() |
46fd6e4f2e | ||
![]() |
6cad940989 | ||
![]() |
c046890191 | ||
![]() |
d70bad04de | ||
![]() |
c8462bd17f | ||
![]() |
a3410b5a1f | ||
![]() |
43039f9386 | ||
![]() |
d0c4d61c8b | ||
![]() |
95db1624ef | ||
![]() |
b0b33ce148 | ||
![]() |
fa4192e31f | ||
![]() |
4c412580fd | ||
![]() |
8f558c3e10 | ||
![]() |
5ebdfbe893 | ||
![]() |
094a35aeef | ||
![]() |
62f9253781 | ||
![]() |
858864d350 | ||
![]() |
ba31b72f46 | ||
![]() |
7594868296 | ||
![]() |
09e391abd8 | ||
![]() |
b90816d94b | ||
![]() |
05015d03da | ||
![]() |
34ecaf6e88 | ||
![]() |
bb46240cbb | ||
![]() |
5ee539f69d | ||
![]() |
8ba3198549 | ||
![]() |
8355383802 | ||
![]() |
c0f7df9662 | ||
![]() |
fc6825ebb6 | ||
![]() |
f074618a9f | ||
![]() |
c6dce25967 | ||
![]() |
aba56c03b9 | ||
![]() |
2e06758479 | ||
![]() |
fc7071cb53 | ||
![]() |
2dfe3a7b4d | ||
![]() |
9d5f16f6fe | ||
![]() |
dc794d7096 | ||
![]() |
31a77177ff | ||
![]() |
9b0d0fd3c4 | ||
![]() |
9925dca119 | ||
![]() |
3d5323a351 | ||
![]() |
69659389a3 | ||
![]() |
731902bd19 | ||
![]() |
85a685ac0a | ||
![]() |
bd593a98dc | ||
![]() |
6f787aa79b | ||
![]() |
1e7f825a9b | ||
![]() |
c50241080d | ||
![]() |
a0361a6c30 | ||
![]() |
22c27e1f4a | ||
![]() |
9d4355d90a | ||
![]() |
0b0e87bb54 | ||
![]() |
4fb6fa477e | ||
![]() |
c8557235fd | ||
![]() |
f719e6566c | ||
![]() |
b9a1efa6f4 | ||
![]() |
3ee967c1d8 | ||
![]() |
e44f89371c | ||
![]() |
e586e4d93b | ||
![]() |
f156dc54f8 | ||
![]() |
685f50b374 | ||
![]() |
6086a4d74d | ||
![]() |
88089eecfd | ||
![]() |
0daf1428e8 | ||
![]() |
97cc2f286f | ||
![]() |
21d568be17 | ||
![]() |
d84c51904c | ||
![]() |
0cb3cab343 | ||
![]() |
b77d9cbbd5 | ||
![]() |
905f5c8a1e | ||
![]() |
20373a66ec | ||
![]() |
d48da91373 | ||
![]() |
62a657de16 | ||
![]() |
747fbe0c21 | ||
![]() |
c1f479e8df | ||
![]() |
d3b40af01f | ||
![]() |
74880e78d8 | ||
![]() |
60dd8b5733 | ||
![]() |
77cf052e39 | ||
![]() |
146eac0a0c | ||
![]() |
4852b3aabd | ||
![]() |
41313bdcc5 | ||
![]() |
088ba9bc3e | ||
![]() |
b642e45d8c | ||
![]() |
a8fc0bb608 | ||
![]() |
7c8beec48c | ||
![]() |
992957ac30 | ||
![]() |
b3c8fd1f0e | ||
![]() |
7327505883 | ||
![]() |
a3b3096772 | ||
![]() |
704952fee5 | ||
![]() |
b6f5a1ca58 | ||
![]() |
efa8603518 | ||
![]() |
1b0082eabc | ||
![]() |
78dbb1a7e1 | ||
![]() |
4f3f2fe14b | ||
![]() |
cdbaaa4f00 | ||
![]() |
d4d1f32e48 | ||
![]() |
c6c4dc6935 | ||
![]() |
494ddd377a | ||
![]() |
37e99e384e | ||
![]() |
73d6f4651e | ||
![]() |
50ebb524cd | ||
![]() |
98e96652f1 | ||
![]() |
4bde8c1369 | ||
![]() |
ece16d91ee | ||
![]() |
3348e66e2e | ||
![]() |
6e8ed38fab | ||
![]() |
f64e4a8c9a | ||
![]() |
d92a7870d7 | ||
![]() |
5fb5ac7148 | ||
![]() |
8d3bc52acd | ||
![]() |
dc745b76aa | ||
![]() |
b6ae41e7f4 | ||
![]() |
670128ff13 | ||
![]() |
1f9073f41b | ||
![]() |
a991c0673f | ||
![]() |
77493bfd97 | ||
![]() |
bb3f1cad17 | ||
![]() |
a6403a3b69 | ||
![]() |
e2cf32ca5f | ||
![]() |
48fd461977 | ||
![]() |
612b28194b | ||
![]() |
8bce2c60b8 | ||
![]() |
488ffb8135 | ||
![]() |
b786ddc0f2 | ||
![]() |
88ae77cea4 | ||
![]() |
5bed920971 | ||
![]() |
705e89d75f | ||
![]() |
ef688e7425 | ||
![]() |
02d1efdd5b | ||
![]() |
469cb61193 | ||
![]() |
a642be972d | ||
![]() |
bc9d341be8 | ||
![]() |
80ddf7889e | ||
![]() |
4be63111d1 | ||
![]() |
6626a7df53 | ||
![]() |
ab434bf0d0 | ||
![]() |
52b18c1fde | ||
![]() |
0b2b8ab979 | ||
![]() |
65bf4c9c45 | ||
![]() |
7c40a0449b | ||
![]() |
811a504c6b | ||
![]() |
75211f2b8c | ||
![]() |
f6687bbb64 | ||
![]() |
1400f1a1e4 | ||
![]() |
1ea5bbc594 | ||
![]() |
f5955d9f6f | ||
![]() |
e14564b926 | ||
![]() |
0f5a0a4155 | ||
![]() |
7acfa7758c | ||
![]() |
56b6909b39 | ||
![]() |
c6f59b95c5 | ||
![]() |
d61c6ebccf | ||
![]() |
b9a287f237 | ||
![]() |
6407800521 | ||
![]() |
6c62098827 | ||
![]() |
a23d6ea1e4 | ||
![]() |
e492818d89 | ||
![]() |
1ca25bc387 | ||
![]() |
057051b848 | ||
![]() |
71fee2ab1e | ||
![]() |
7d3e217623 | ||
![]() |
2ac6b573a4 | ||
![]() |
7f8846405e | ||
![]() |
81bcf9454e | ||
![]() |
5a3c8f95d5 | ||
![]() |
358e4081ed | ||
![]() |
6baaaa0174 | ||
![]() |
9e3e11a348 | ||
![]() |
1d20d975aa | ||
![]() |
e67491a2a4 | ||
![]() |
e1a86b1433 | ||
![]() |
5310da7e83 | ||
![]() |
4eede1fca2 | ||
![]() |
b7765d00f9 | ||
![]() |
5479e08cc4 | ||
![]() |
d0249f1c2e | ||
![]() |
108ca6fad1 | ||
![]() |
5bee21d724 | ||
![]() |
1f8bf163e4 | ||
![]() |
7e35c50b81 | ||
![]() |
e835ce83e2 | ||
![]() |
00bf66785f | ||
![]() |
e0e4250421 | ||
![]() |
901682ff78 | ||
![]() |
5af78cc98d | ||
![]() |
59f22ef91a | ||
![]() |
5393a5600d | ||
![]() |
077beee465 | ||
![]() |
02d3ad8609 |
@@ -445,10 +445,11 @@ x86 Michael Niedermayer
|
||||
Releases
|
||||
========
|
||||
|
||||
1.2 Michael Niedermayer
|
||||
1.1 Michael Niedermayer
|
||||
1.0 Michael Niedermayer
|
||||
0.11 Michael Niedermayer
|
||||
|
||||
If you want to maintain an older release, please contact us
|
||||
|
||||
|
||||
GnuPG Fingerprints of maintainers and contributors
|
||||
|
@@ -1851,7 +1851,7 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu
|
||||
/* XXX this shouldn't be needed, but some tests break without this line
|
||||
* those decoders are buggy and need to be fixed.
|
||||
* the following tests fail:
|
||||
* cdgraphics, ansi, aasc, fraps-v1, qtrle-1bit
|
||||
* cdgraphics, ansi
|
||||
*/
|
||||
memset(buf->base[0], 128, ret);
|
||||
|
||||
|
@@ -190,13 +190,13 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags,
|
||||
void show_help_children(const AVClass *class, int flags);
|
||||
|
||||
/**
|
||||
* Per-avtool specific help handler. Implemented in each
|
||||
* avtool, called by show_help().
|
||||
* Per-fftool specific help handler. Implemented in each
|
||||
* fftool, called by show_help().
|
||||
*/
|
||||
void show_help_default(const char *opt, const char *arg);
|
||||
|
||||
/**
|
||||
* Generic -h handler common to all avtools.
|
||||
* Generic -h handler common to all fftools.
|
||||
*/
|
||||
int show_help(void *optctx, const char *opt, const char *arg);
|
||||
|
||||
|
33
configure
vendored
33
configure
vendored
@@ -1466,6 +1466,7 @@ HAVE_LIST="
|
||||
CONFIG_EXTRA="
|
||||
aandcttables
|
||||
ac3dsp
|
||||
audio_frame_queue
|
||||
error_resilience
|
||||
gcrypt
|
||||
golomb
|
||||
@@ -1633,7 +1634,7 @@ mpegvideoenc_select="mpegvideo"
|
||||
|
||||
# decoders / encoders
|
||||
aac_decoder_select="mdct sinewin"
|
||||
aac_encoder_select="mdct sinewin"
|
||||
aac_encoder_select="audio_frame_queue mdct sinewin"
|
||||
aac_latm_decoder_select="aac_decoder aac_latm_parser"
|
||||
ac3_decoder_select="mdct ac3dsp ac3_parser"
|
||||
ac3_encoder_select="mdct ac3dsp"
|
||||
@@ -1718,13 +1719,13 @@ msmpeg4v3_decoder_select="h263_decoder"
|
||||
msmpeg4v3_encoder_select="h263_encoder"
|
||||
mss2_decoder_select="vc1_decoder"
|
||||
nellymoser_decoder_select="mdct sinewin"
|
||||
nellymoser_encoder_select="mdct sinewin"
|
||||
nellymoser_encoder_select="audio_frame_queue mdct sinewin"
|
||||
nuv_decoder_select="lzo"
|
||||
png_decoder_select="zlib"
|
||||
png_encoder_select="zlib"
|
||||
qcelp_decoder_select="lsp"
|
||||
qdm2_decoder_select="mdct rdft mpegaudiodsp"
|
||||
ra_144_encoder_select="lpc"
|
||||
ra_144_encoder_select="audio_frame_queue lpc"
|
||||
ralf_decoder_select="golomb"
|
||||
rv10_decoder_select="h263_decoder"
|
||||
rv10_encoder_select="h263_encoder"
|
||||
@@ -1780,14 +1781,15 @@ zmbv_encoder_select="zlib"
|
||||
|
||||
# hardware accelerators
|
||||
crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
|
||||
dxva2_deps="dxva2api_h"
|
||||
vaapi_deps="va_va_h"
|
||||
vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
|
||||
vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
|
||||
|
||||
h263_vaapi_hwaccel_select="vaapi h263_decoder"
|
||||
h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
|
||||
h264_dxva2_hwaccel_deps="dxva2api_h"
|
||||
h264_dxva2_hwaccel_select="dxva2 h264_decoder"
|
||||
h264_dxva2_hwaccel_deps="dxva2"
|
||||
h264_dxva2_hwaccel_select="h264_decoder"
|
||||
h264_vaapi_hwaccel_select="vaapi h264_decoder"
|
||||
h264_vda_decoder_select="vda h264_parser h264_decoder"
|
||||
h264_vda_hwaccel_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
|
||||
@@ -1797,8 +1799,8 @@ mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
|
||||
mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
|
||||
mpeg1_vdpau_hwaccel_select="vdpau mpeg1video_decoder"
|
||||
mpeg2_crystalhd_decoder_select="crystalhd"
|
||||
mpeg2_dxva2_hwaccel_deps="dxva2api_h"
|
||||
mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
|
||||
mpeg2_dxva2_hwaccel_deps="dxva2"
|
||||
mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
|
||||
mpeg2_vdpau_hwaccel_select="vdpau mpeg2video_decoder"
|
||||
mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
|
||||
mpeg4_crystalhd_decoder_select="crystalhd"
|
||||
@@ -1806,8 +1808,8 @@ mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
|
||||
mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
|
||||
msmpeg4_crystalhd_decoder_select="crystalhd"
|
||||
vc1_crystalhd_decoder_select="crystalhd"
|
||||
vc1_dxva2_hwaccel_deps="dxva2api_h"
|
||||
vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
|
||||
vc1_dxva2_hwaccel_deps="dxva2"
|
||||
vc1_dxva2_hwaccel_select="vc1_decoder"
|
||||
vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
|
||||
vc1_vdpau_decoder_select="vdpau vc1_decoder"
|
||||
wmv3_crystalhd_decoder_select="crystalhd"
|
||||
@@ -1825,7 +1827,9 @@ vc1_parser_select="error_resilience mpegvideo"
|
||||
libaacplus_encoder_deps="libaacplus"
|
||||
libcelt_decoder_deps="libcelt"
|
||||
libfaac_encoder_deps="libfaac"
|
||||
libfaac_encoder_select="audio_frame_queue"
|
||||
libfdk_aac_encoder_deps="libfdk_aac"
|
||||
libfdk_aac_encoder_select="audio_frame_queue"
|
||||
libgsm_decoder_deps="libgsm"
|
||||
libgsm_encoder_deps="libgsm"
|
||||
libgsm_ms_decoder_deps="libgsm"
|
||||
@@ -1834,24 +1838,30 @@ libilbc_decoder_deps="libilbc"
|
||||
libilbc_encoder_deps="libilbc"
|
||||
libmodplug_demuxer_deps="libmodplug"
|
||||
libmp3lame_encoder_deps="libmp3lame"
|
||||
libmp3lame_encoder_select="audio_frame_queue"
|
||||
libopencore_amrnb_decoder_deps="libopencore_amrnb"
|
||||
libopencore_amrnb_encoder_deps="libopencore_amrnb"
|
||||
libopencore_amrnb_encoder_select="audio_frame_queue"
|
||||
libopencore_amrwb_decoder_deps="libopencore_amrwb"
|
||||
libopenjpeg_decoder_deps="libopenjpeg"
|
||||
libopenjpeg_encoder_deps="libopenjpeg"
|
||||
libopus_decoder_deps="libopus"
|
||||
libopus_encoder_deps="libopus"
|
||||
libopus_encoder_select="audio_frame_queue"
|
||||
libschroedinger_decoder_deps="libschroedinger"
|
||||
libschroedinger_encoder_deps="libschroedinger"
|
||||
libspeex_decoder_deps="libspeex"
|
||||
libspeex_encoder_deps="libspeex"
|
||||
libspeex_encoder_select="audio_frame_queue"
|
||||
libstagefright_h264_decoder_deps="libstagefright_h264"
|
||||
libtheora_encoder_deps="libtheora"
|
||||
libtwolame_encoder_deps="libtwolame"
|
||||
libvo_aacenc_encoder_deps="libvo_aacenc"
|
||||
libvo_aacenc_encoder_select="audio_frame_queue"
|
||||
libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
|
||||
libvorbis_decoder_deps="libvorbis"
|
||||
libvorbis_encoder_deps="libvorbis"
|
||||
libvorbis_encoder_select="audio_frame_queue"
|
||||
libvpx_decoder_deps="libvpx"
|
||||
libvpx_encoder_deps="libvpx"
|
||||
libx264_encoder_deps="libx264"
|
||||
@@ -2090,6 +2100,9 @@ enable safe_bitstream_reader
|
||||
enable static
|
||||
enable swscale_alpha
|
||||
|
||||
# By default, enable only those hwaccels that have no external dependencies.
|
||||
enable dxva2 vdpau
|
||||
|
||||
# build settings
|
||||
SHFLAGS='-shared -Wl,-soname,$$(@F)'
|
||||
FFSERVERLDFLAGS=-Wl,-E
|
||||
@@ -4094,6 +4107,7 @@ elif enabled gcc; then
|
||||
check_optflags -fno-tree-vectorize
|
||||
check_cflags -Werror=implicit-function-declaration
|
||||
check_cflags -Werror=missing-prototypes
|
||||
check_cflags -Werror=return-type
|
||||
check_cflags -Werror=vla
|
||||
elif enabled llvm_gcc; then
|
||||
check_cflags -mllvm -stack-alignment=16
|
||||
@@ -4102,6 +4116,7 @@ elif enabled clang; then
|
||||
check_cflags -Qunused-arguments
|
||||
check_cflags -Werror=implicit-function-declaration
|
||||
check_cflags -Werror=missing-prototypes
|
||||
check_cflags -Werror=return-type
|
||||
elif enabled armcc; then
|
||||
# 2523: use of inline assembler is deprecated
|
||||
add_cflags -W${armcc_opt},--diag_suppress=2523
|
||||
|
332
doc/APIchanges
332
doc/APIchanges
@@ -132,30 +132,30 @@ API changes, most recent first:
|
||||
2012-03-26 - a67d9cf - lavfi 2.66.100
|
||||
Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
|
||||
|
||||
2012-12-29 - d8fd06c - lavu 52.3.0 - avstring.h
|
||||
2012-12-29 - 2ce43b3 / d8fd06c - lavu 52.13.100 / 52.3.0 - avstring.h
|
||||
Add av_basename() and av_dirname().
|
||||
|
||||
2012-11-11 - 5980f5d - lavu 52.2.0 - audioconvert.h
|
||||
2012-11-11 - 03b0787 / 5980f5d - lavu 52.6.100 / 52.2.0 - audioconvert.h
|
||||
Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated.
|
||||
|
||||
2012-11-05 - dfde8a3 - lavu 52.1.0 - intmath.h
|
||||
2012-11-05 - 7d26be6 / dfde8a3 - lavu 52.5.100 / 52.1.0 - intmath.h
|
||||
Add av_ctz() for trailing zero bit count
|
||||
|
||||
2012-10-21 - a893655 - lavu 51.45.0 - error.h
|
||||
2012-10-21 - e3a91c5 / a893655 - lavu 51.77.100 / 51.45.0 - error.h
|
||||
Add AVERROR_EXPERIMENTAL
|
||||
|
||||
2012-10-12 - d2fcb35 - lavu 51.44.0 - pixdesc.h
|
||||
2012-10-12 - a33ed6b / d2fcb35 - lavu 51.76.100 / 51.44.0 - pixdesc.h
|
||||
Add functions for accessing pixel format descriptors.
|
||||
Accessing the av_pix_fmt_descriptors array directly is now
|
||||
deprecated.
|
||||
|
||||
2012-10-11 - 9a92aea - lavu 51.43.0 - aes.h, md5.h, sha.h, tree.h
|
||||
2012-10-11 - f391e40 / 9a92aea - lavu 51.75.100 / 51.43.0 - aes.h, md5.h, sha.h, tree.h
|
||||
Add functions for allocating the opaque contexts for the algorithms,
|
||||
|
||||
2012-10-10 - b522000 - lavf 54.18.0 - avio.h
|
||||
2012-10-10 - de31814 / b522000 - lavf 54.32.100 / 54.18.0 - avio.h
|
||||
Add avio_closep to complement avio_close.
|
||||
|
||||
2012-10-08 - 78071a1 - lavu 51.42.0 - pixfmt.h
|
||||
2012-10-08 - ae77266 / 78071a1 - lavu 51.74.100 / 51.42.0 - pixfmt.h
|
||||
Rename PixelFormat to AVPixelFormat and all PIX_FMT_* to AV_PIX_FMT_*.
|
||||
To provide backwards compatibility, PixelFormat is now #defined as
|
||||
AVPixelFormat.
|
||||
@@ -163,23 +163,23 @@ API changes, most recent first:
|
||||
'PixelFormat' identifier. Such code should either #undef PixelFormat
|
||||
or stop using the PixelFormat name.
|
||||
|
||||
2012-10-05 - e7ba5b1 - lavr 1.0.0 - avresample.h
|
||||
2012-10-05 - 55c49af / e7ba5b1 - lavr 1.0.0 - avresample.h
|
||||
Data planes parameters to avresample_convert() and
|
||||
avresample_read() are now uint8_t** instead of void**.
|
||||
Libavresample is now stable.
|
||||
|
||||
2012-09-24 - a42aada - lavc 54.28.0 - avcodec.h
|
||||
2012-09-24 - 46a3595 / a42aada - lavc 54.59.100 / 54.28.0 - avcodec.h
|
||||
Add avcodec_free_frame(). This function must now
|
||||
be used for freeing an AVFrame.
|
||||
|
||||
2012-09-12 - 8919fee - lavu 51.41.0 - audioconvert.h
|
||||
2012-09-12 - e3e09f2 / 8919fee - lavu 51.73.100 / 51.41.0 - audioconvert.h
|
||||
Added AV_CH_LOW_FREQUENCY_2 channel mask value.
|
||||
|
||||
2012-09-04 - 686a329 - lavu 51.40.0 - opt.h
|
||||
2012-09-04 - b21b5b0 / 686a329 - lavu 51.71.100 / 51.40.0 - opt.h
|
||||
Reordered the fields in default_val in AVOption, changed which
|
||||
default_val field is used for which AVOptionType.
|
||||
|
||||
2012-08-30 - a231832 - lavc 54.26.1 - avcodec.h
|
||||
2012-08-30 - 98298eb / a231832 - lavc 54.54.101 / 54.26.1 - avcodec.h
|
||||
Add codec descriptor properties AV_CODEC_PROP_LOSSY and
|
||||
AV_CODEC_PROP_LOSSLESS.
|
||||
|
||||
@@ -187,90 +187,90 @@ API changes, most recent first:
|
||||
Add codec descriptors for accessing codec properties without having
|
||||
to refer to a specific decoder or encoder.
|
||||
|
||||
c223d79 - Add an AVCodecDescriptor struct and functions
|
||||
f5f3684 / c223d79 - Add an AVCodecDescriptor struct and functions
|
||||
avcodec_descriptor_get() and avcodec_descriptor_next().
|
||||
51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY.
|
||||
91e59fe - Add avcodec_descriptor_get_by_name().
|
||||
f5f3684 / 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY.
|
||||
6c180b3 / 91e59fe - Add avcodec_descriptor_get_by_name().
|
||||
|
||||
2012-08-08 - 987170c - lavu 51.38 - dict.h
|
||||
2012-08-08 - f5f3684 / 987170c - lavu 51.68.100 / 51.38.0 - dict.h
|
||||
Add av_dict_count().
|
||||
|
||||
2012-08-07 - 104e10f - lavc 54.25 - avcodec.h
|
||||
2012-08-07 - 7a72695 / 104e10f - lavc 54.51.100 / 54.25.0 - avcodec.h
|
||||
Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*.
|
||||
To provide backwards compatibility, CodecID is now #defined as AVCodecID.
|
||||
Note that this can break user code that includes avcodec.h and uses the
|
||||
'CodecID' identifier. Such code should either #undef CodecID or stop using the
|
||||
CodecID name.
|
||||
|
||||
2012-08-03 - 239fdf1 - lavu 51.37.1 - cpu.h
|
||||
2012-08-03 - e776ee8 / 239fdf1 - lavu 51.66.101 / 51.37.1 - cpu.h
|
||||
lsws 2.1.1 - swscale.h
|
||||
Rename AV_CPU_FLAG_MMX2 ---> AV_CPU_FLAG_MMXEXT.
|
||||
Rename SWS_CPU_CAPS_MMX2 ---> SWS_CPU_CAPS_MMXEXT.
|
||||
|
||||
2012-07-29 - 681ed00 - lavf 54.13.0 - avformat.h
|
||||
2012-07-29 - 7c26761 / 681ed00 - lavf 54.22.100 / 54.13.0 - avformat.h
|
||||
Add AVFMT_FLAG_NOBUFFER for low latency use cases.
|
||||
|
||||
2012-07-10 - 5fade8a - lavu 51.37.0
|
||||
Add av_malloc_array() and av_mallocz_array()
|
||||
|
||||
2012-06-22 - d3d3a32 - lavu 51.34.0
|
||||
2012-06-22 - e847f41 / d3d3a32 - lavu 51.61.100 / 51.34.0
|
||||
Add av_usleep()
|
||||
|
||||
2012-06-20 - ae0a301 - lavu 51.33.0
|
||||
2012-06-20 - 4da42eb / ae0a301 - lavu 51.60.100 / 51.33.0
|
||||
Move av_gettime() to libavutil, add libavutil/time.h
|
||||
|
||||
2012-06-09 - 3971be0 - lavr 0.0.3
|
||||
2012-06-09 - 82edf67 / 3971be0 - lavr 0.0.3
|
||||
Add a parameter to avresample_build_matrix() for Dolby/DPLII downmixing.
|
||||
|
||||
2012-06-12 - 9baeff9 - lavfi 2.23.0 - avfilter.h
|
||||
2012-06-12 - c7b9eab / 9baeff9 - lavfi 2.79.100 / 2.23.0 - avfilter.h
|
||||
Add AVFilterContext.nb_inputs/outputs. Deprecate
|
||||
AVFilterContext.input/output_count.
|
||||
|
||||
2012-06-12 - 84b9fbe - lavfi 2.22.0 - avfilter.h
|
||||
2012-06-12 - c7b9eab / 84b9fbe - lavfi 2.79.100 / 2.22.0 - avfilter.h
|
||||
Add avfilter_pad_get_type() and avfilter_pad_get_name(). Those
|
||||
should now be used instead of accessing AVFilterPad members
|
||||
directly.
|
||||
|
||||
2012-06-12 - b0f0dfc - lavu 51.32.0 - audioconvert.h
|
||||
2012-06-12 - 3630a07 / b0f0dfc - lavu 51.57.100 / 51.32.0 - audioconvert.h
|
||||
Add av_get_channel_layout_channel_index(), av_get_channel_name()
|
||||
and av_channel_layout_extract_channel().
|
||||
|
||||
2012-05-25 - 154486f - lavu 51.31.0 - opt.h
|
||||
2012-05-25 - 53ce990 / 154486f - lavu 51.55.100 / 51.31.0 - opt.h
|
||||
Add av_opt_set_bin()
|
||||
|
||||
2012-05-15 - lavfi 2.17.0
|
||||
2012-05-15 - lavfi 2.74.100 / 2.17.0
|
||||
Add support for audio filters
|
||||
ac71230/a2cd9be - add video/audio buffer sink in a new installed
|
||||
61930bd / ac71230, 1cbf7fb / a2cd9be - add video/audio buffer sink in a new installed
|
||||
header buffersink.h
|
||||
720c6b7 - add av_buffersrc_write_frame(), deprecate
|
||||
1cbf7fb / 720c6b7 - add av_buffersrc_write_frame(), deprecate
|
||||
av_vsrc_buffer_add_frame()
|
||||
ab16504 - add avfilter_copy_buf_props()
|
||||
9453c9e - add extended_data to AVFilterBuffer
|
||||
1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays()
|
||||
61930bd / ab16504 - add avfilter_copy_buf_props()
|
||||
61930bd / 9453c9e - add extended_data to AVFilterBuffer
|
||||
61930bd / 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays()
|
||||
|
||||
2012-05-09 - lavu 51.30.0 - samplefmt.h
|
||||
142e740 - add av_samples_copy()
|
||||
6d7f617 - add av_samples_set_silence()
|
||||
2012-05-09 - lavu 51.53.100 / 51.30.0 - samplefmt.h
|
||||
61930bd / 142e740 - add av_samples_copy()
|
||||
61930bd / 6d7f617 - add av_samples_set_silence()
|
||||
|
||||
2012-05-09 - a5117a2 - lavc 54.13.1
|
||||
2012-05-09 - 61930bd / a5117a2 - lavc 54.21.101 / 54.13.1
|
||||
For audio formats with fixed frame size, the last frame
|
||||
no longer needs to be padded with silence, libavcodec
|
||||
will handle this internally (effectively all encoders
|
||||
behave as if they had CODEC_CAP_SMALL_LAST_FRAME set).
|
||||
|
||||
2012-05-07 - 828bd08 - lavc 54.13.0 - avcodec.h
|
||||
2012-05-07 - 653d117 / 828bd08 - lavc 54.20.100 / 54.13.0 - avcodec.h
|
||||
Add sample_rate and channel_layout fields to AVFrame.
|
||||
|
||||
2012-05-01 - 4010d72 - lavr 0.0.1
|
||||
2012-05-01 - 2330eb1 / 4010d72 - lavr 0.0.1
|
||||
Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
|
||||
|
||||
2012-04-25 - 3527a73 - lavu 51.29.0 - cpu.h
|
||||
2012-04-25 - e890b68 / 3527a73 - lavu 51.48.100 / 51.29.0 - cpu.h
|
||||
Add av_parse_cpu_flags()
|
||||
|
||||
2012-04-24 - c8af852 - lavr 0.0.0
|
||||
2012-04-24 - 3ead79e / c8af852 - lavr 0.0.0
|
||||
Add libavresample audio conversion library
|
||||
|
||||
2012-04-20 - 0c0d1bc - lavu 51.28.0 - audio_fifo.h
|
||||
2012-04-20 - 3194ab7 / 0c0d1bc - lavu 51.47.100 / 51.28.0 - audio_fifo.h
|
||||
Add audio FIFO functions:
|
||||
av_audio_fifo_free()
|
||||
av_audio_fifo_alloc()
|
||||
@@ -282,10 +282,10 @@ API changes, most recent first:
|
||||
av_audio_fifo_size()
|
||||
av_audio_fifo_space()
|
||||
|
||||
2012-04-14 - lavfi 2.16.0 - avfiltergraph.h
|
||||
d7bcc71 Add avfilter_graph_parse2().
|
||||
2012-04-14 - lavfi 2.70.100 / 2.16.0 - avfiltergraph.h
|
||||
7432bcf / d7bcc71 Add avfilter_graph_parse2().
|
||||
|
||||
2012-04-08 - 4d693b0 - lavu 51.27.0 - samplefmt.h
|
||||
2012-04-08 - 6bfb304 / 4d693b0 - lavu 51.46.100 / 51.27.0 - samplefmt.h
|
||||
Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt()
|
||||
|
||||
2012-03-21 - b75c67d - lavu 51.43.100
|
||||
@@ -313,73 +313,73 @@ API changes, most recent first:
|
||||
2012-01-24 - 0c3577b - lavfi 2.60.100
|
||||
Add avfilter_graph_dump.
|
||||
|
||||
2012-03-20 - 3c90cc2 - lavfo 54.2.0
|
||||
2012-03-20 - 0ebd836 / 3c90cc2 - lavfo 54.2.0
|
||||
Deprecate av_read_packet(), use av_read_frame() with
|
||||
AVFMT_FLAG_NOPARSE | AVFMT_FLAG_NOFILLIN in AVFormatContext.flags
|
||||
|
||||
2012-03-05 - lavc 54.8.0
|
||||
6699d07 Add av_get_exact_bits_per_sample()
|
||||
9524cf7 Add av_get_audio_frame_duration()
|
||||
2012-03-05 - lavc 54.10.100 / 54.8.0
|
||||
f095391 / 6699d07 Add av_get_exact_bits_per_sample()
|
||||
f095391 / 9524cf7 Add av_get_audio_frame_duration()
|
||||
|
||||
2012-03-04 - 44fe77b - lavc 54.7.0 - avcodec.h
|
||||
2012-03-04 - 2af8f2c / 44fe77b - lavc 54.8.100 / 54.7.0 - avcodec.h
|
||||
Add av_codec_is_encoder/decoder().
|
||||
|
||||
2012-03-01 - 442c132 - lavc 54.3.0 - avcodec.h
|
||||
2012-03-01 - 1eb7f39 / 442c132 - lavc 54.5.100 / 54.3.0 - avcodec.h
|
||||
Add av_packet_shrink_side_data.
|
||||
|
||||
2012-02-29 - dd2a4bc - lavf 54.2.0 - avformat.h
|
||||
2012-02-29 - 79ae084 / dd2a4bc - lavf 54.2.100 / 54.2.0 - avformat.h
|
||||
Add AVStream.attached_pic and AV_DISPOSITION_ATTACHED_PIC,
|
||||
used for dealing with attached pictures/cover art.
|
||||
|
||||
2012-02-25 - c9bca80 - lavu 51.24.0 - error.h
|
||||
2012-02-25 - 305e4b3 / c9bca80 - lavu 51.41.100 / 51.24.0 - error.h
|
||||
Add AVERROR_UNKNOWN
|
||||
NOTE: this was backported to 0.8
|
||||
|
||||
2012-02-20 - e9cda85 - lavc 54.2.0
|
||||
2012-02-20 - eadd426 / e9cda85 - lavc 54.2.100 / 54.2.0
|
||||
Add duration field to AVCodecParserContext
|
||||
|
||||
2012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h
|
||||
2012-02-20 - eadd426 / 0b42a93 - lavu 51.40.100 / 51.23.1 - mathematics.h
|
||||
Add av_rescale_q_rnd()
|
||||
|
||||
2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h
|
||||
2012-02-08 - f2b20b7 / 38d5533 - lavu 51.38.101 / 51.22.1 - pixdesc.h
|
||||
Add PIX_FMT_PSEUDOPAL flag.
|
||||
|
||||
2012-02-08 - 52f82a1 - lavc 54.01.0
|
||||
2012-02-08 - f2b20b7 / 52f82a1 - lavc 54.2.100 / 54.1.0
|
||||
Add avcodec_encode_video2() and deprecate avcodec_encode_video().
|
||||
|
||||
2012-02-01 - 316fc74 - lavc 54.01.0
|
||||
2012-02-01 - 4c677df / 316fc74 - lavc 54.1.0
|
||||
Add av_fast_padded_malloc() as alternative for av_realloc() when aligned
|
||||
memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE
|
||||
zero-padded bytes at the end.
|
||||
|
||||
2012-01-31 - dd6d3b0 - lavf 54.01.0
|
||||
2012-01-31 - a369a6b / dd6d3b0 - lavf 54.1.0
|
||||
Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
|
||||
NOTE: this was backported to 0.8
|
||||
|
||||
2012-01-31 - af08d9a - lavc 54.01.0
|
||||
2012-01-31 - a369a6b / af08d9a - lavc 54.1.0
|
||||
Add avcodec_is_open() function.
|
||||
NOTE: this was backported to 0.8
|
||||
|
||||
2012-01-30 - 8b93312 - lavu 51.22.0 - intfloat.h
|
||||
2012-01-30 - 151ecc2 / 8b93312 - lavu 51.36.100 / 51.22.0 - intfloat.h
|
||||
Add a new installed header libavutil/intfloat.h with int/float punning
|
||||
functions.
|
||||
NOTE: this was backported to 0.8
|
||||
|
||||
2012-01-25 - lavf 53.22.0
|
||||
f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible
|
||||
2012-01-25 - lavf 53.31.100 / 53.22.0
|
||||
3c5fe5b / f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible
|
||||
buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for
|
||||
muxers supporting it (av_write_frame makes sure it is called
|
||||
only for muxers with this flag).
|
||||
|
||||
2012-01-15 - lavc 53.34.0
|
||||
2012-01-15 - lavc 53.56.105 / 53.34.0
|
||||
New audio encoding API:
|
||||
b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
|
||||
67f5650 / b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
|
||||
encoders.
|
||||
5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function.
|
||||
b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
|
||||
67f5650 / 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function.
|
||||
67f5650 / b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
|
||||
Add AVCodec.encode2().
|
||||
|
||||
2012-01-12 - 3167dc9 - lavfi 2.15.0
|
||||
2012-01-12 - b18e17e / 3167dc9 - lavfi 2.59.100 / 2.15.0
|
||||
Add a new installed header -- libavfilter/version.h -- with version macros.
|
||||
|
||||
2011-12-08 - a502939 - lavfi 2.52.0
|
||||
@@ -400,37 +400,37 @@ API changes, most recent first:
|
||||
2011-10-20 - b35e9e1 - lavu 51.22.0
|
||||
Add av_strtok() to avstring.h.
|
||||
|
||||
2011-01-03 - b73ec05 - lavu 51.21.0
|
||||
2012-01-03 - ad1c8dd / b73ec05 - lavu 51.34.100 / 51.21.0
|
||||
Add av_popcount64
|
||||
|
||||
2011-12-18 - 8400b12 - lavc 53.28.1
|
||||
2011-12-18 - 7c29313 / 8400b12 - lavc 53.46.1 / 53.28.1
|
||||
Deprecate AVFrame.age. The field is unused.
|
||||
|
||||
2011-12-12 - 5266045 - lavf 53.17.0
|
||||
2011-12-12 - 8bc7fe4 / 5266045 - lavf 53.25.0 / 53.17.0
|
||||
Add avformat_close_input().
|
||||
Deprecate av_close_input_file() and av_close_input_stream().
|
||||
|
||||
2011-12-02 - 0eea212 - lavc 53.25.0
|
||||
2011-12-02 - e4de716 / 0eea212 - lavc 53.40.0 / 53.25.0
|
||||
Add nb_samples and extended_data fields to AVFrame.
|
||||
Deprecate AVCODEC_MAX_AUDIO_FRAME_SIZE.
|
||||
Deprecate avcodec_decode_audio3() in favor of avcodec_decode_audio4().
|
||||
avcodec_decode_audio4() writes output samples to an AVFrame, which allows
|
||||
audio decoders to use get_buffer().
|
||||
|
||||
2011-12-04 - 560f773 - lavc 53.24.0
|
||||
2011-12-04 - e4de716 / 560f773 - lavc 53.40.0 / 53.24.0
|
||||
Change AVFrame.data[4]/base[4]/linesize[4]/error[4] to [8] at next major bump.
|
||||
Change AVPicture.data[4]/linesize[4] to [8] at next major bump.
|
||||
Change AVCodecContext.error[4] to [8] at next major bump.
|
||||
Add AV_NUM_DATA_POINTERS to simplify the bump transition.
|
||||
|
||||
2011-11-23 - bbb46f3 - lavu 51.18.0
|
||||
2011-11-23 - 8e576d5 / bbb46f3 - lavu 51.27.0 / 51.18.0
|
||||
Add av_samples_get_buffer_size(), av_samples_fill_arrays(), and
|
||||
av_samples_alloc(), to samplefmt.h.
|
||||
|
||||
2011-11-23 - 8889cc4 - lavu 51.17.0
|
||||
2011-11-23 - 8e576d5 / 8889cc4 - lavu 51.27.0 / 51.17.0
|
||||
Add planar sample formats and av_sample_fmt_is_planar() to samplefmt.h.
|
||||
|
||||
2011-11-19 - f3a29b7 - lavc 53.21.0
|
||||
2011-11-19 - dbb38bc / f3a29b7 - lavc 53.36.0 / 53.21.0
|
||||
Move some AVCodecContext fields to a new private struct, AVCodecInternal,
|
||||
which is accessed from a new field, AVCodecContext.internal.
|
||||
- fields moved:
|
||||
@@ -438,55 +438,55 @@ API changes, most recent first:
|
||||
AVCodecContext.internal_buffer_count --> AVCodecInternal.buffer_count
|
||||
AVCodecContext.is_copy --> AVCodecInternal.is_copy
|
||||
|
||||
2011-11-16 - 6270671 - lavu 51.16.0
|
||||
2011-11-16 - 8709ba9 / 6270671 - lavu 51.26.0 / 51.16.0
|
||||
Add av_timegm()
|
||||
|
||||
2011-11-13 - lavf 53.15.0
|
||||
2011-11-13 - lavf 53.21.0 / 53.15.0
|
||||
New interrupt callback API, allowing per-AVFormatContext/AVIOContext
|
||||
interrupt callbacks.
|
||||
6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to
|
||||
5f268ca / 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to
|
||||
AVFormatContext.
|
||||
1dee0ac Add avio_open2() with additional parameters. Those are
|
||||
5f268ca / 1dee0ac Add avio_open2() with additional parameters. Those are
|
||||
an interrupt callback and an options AVDictionary.
|
||||
This will allow passing AVOptions to protocols after lavf
|
||||
54.0.
|
||||
|
||||
2011-11-06 - ba04ecf - lavu 51.14.0
|
||||
2011-11-06 - 13b7781 / ba04ecf - lavu 51.24.0 / 51.14.0
|
||||
Add av_strcasecmp() and av_strncasecmp() to avstring.h.
|
||||
|
||||
2011-11-06 - 07b172f - lavu 51.13.0
|
||||
2011-11-06 - 13b7781 / 07b172f - lavu 51.24.0 / 51.13.0
|
||||
Add av_toupper()/av_tolower()
|
||||
|
||||
2011-11-05 - b6d08f4 - lavf 53.13.0
|
||||
2011-11-05 - d8cab5c / b6d08f4 - lavf 53.19.0 / 53.13.0
|
||||
Add avformat_network_init()/avformat_network_deinit()
|
||||
|
||||
2011-10-27 - 512557b - lavc 53.15.0
|
||||
2011-10-27 - 6faf0a2 / 512557b - lavc 53.24.0 / 53.15.0
|
||||
Remove avcodec_parse_frame.
|
||||
Deprecate AVCodecContext.parse_only and CODEC_CAP_PARSE_ONLY.
|
||||
|
||||
2011-10-19 - 569129a - lavf 53.10.0
|
||||
2011-10-19 - d049257 / 569129a - lavf 53.17.0 / 53.10.0
|
||||
Add avformat_new_stream(). Deprecate av_new_stream().
|
||||
|
||||
2011-10-13 - b631fba - lavf 53.9.0
|
||||
2011-10-13 - 91eb1b1 / b631fba - lavf 53.16.0 / 53.9.0
|
||||
Add AVFMT_NO_BYTE_SEEK AVInputFormat flag.
|
||||
|
||||
2011-10-12 - lavu 51.12.0
|
||||
2011-10-12 - lavu 51.21.0 / 51.12.0
|
||||
AVOptions API rewrite.
|
||||
|
||||
- 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_*
|
||||
- f884ef0 / 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_*
|
||||
- new setting/getting functions with slightly different semantics:
|
||||
dac66da av_set_string3 -> av_opt_set
|
||||
f884ef0 / dac66da av_set_string3 -> av_opt_set
|
||||
av_set_double -> av_opt_set_double
|
||||
av_set_q -> av_opt_set_q
|
||||
av_set_int -> av_opt_set_int
|
||||
|
||||
41d9d51 av_get_string -> av_opt_get
|
||||
f884ef0 / 41d9d51 av_get_string -> av_opt_get
|
||||
av_get_double -> av_opt_get_double
|
||||
av_get_q -> av_opt_get_q
|
||||
av_get_int -> av_opt_get_int
|
||||
|
||||
- 8c5dcaa trivial rename av_next_option -> av_opt_next
|
||||
- 641c7af new functions - av_opt_child_next, av_opt_child_class_next
|
||||
- f884ef0 / 8c5dcaa trivial rename av_next_option -> av_opt_next
|
||||
- f884ef0 / 641c7af new functions - av_opt_child_next, av_opt_child_class_next
|
||||
and av_opt_find2()
|
||||
|
||||
2011-09-22 - a70e787 - lavu 51.17.0
|
||||
@@ -532,31 +532,31 @@ API changes, most recent first:
|
||||
2011-08-20 - 69e2c1a - lavu 51.13.0
|
||||
Add av_get_media_type_string().
|
||||
|
||||
2011-09-03 - fb4ca26 - lavc 53.13.0
|
||||
2011-09-03 - 1889c67 / fb4ca26 - lavc 53.13.0
|
||||
lavf 53.11.0
|
||||
lsws 2.1.0
|
||||
Add {avcodec,avformat,sws}_get_class().
|
||||
|
||||
2011-08-03 - c11fb82 - lavu 51.15.0
|
||||
2011-08-03 - 1889c67 / c11fb82 - lavu 51.15.0
|
||||
Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function.
|
||||
|
||||
2011-08-14 - 323b930 - lavu 51.12.0
|
||||
Add av_fifo_peek2(), deprecate av_fifo_peek().
|
||||
|
||||
2011-08-26 - lavu 51.9.0
|
||||
- add41de..abc78a5 Do not include intfloat_readwrite.h,
|
||||
2011-08-26 - lavu 51.14.0 / 51.9.0
|
||||
- 976a8b2 / add41de..976a8b2 / abc78a5 Do not include intfloat_readwrite.h,
|
||||
mathematics.h, rational.h, pixfmt.h, or log.h from avutil.h.
|
||||
|
||||
2011-08-16 - 48f9e45 - lavf 53.8.0
|
||||
2011-08-16 - 27fbe31 / 48f9e45 - lavf 53.11.0 / 53.8.0
|
||||
Add avformat_query_codec().
|
||||
|
||||
2011-08-16 - bca06e7 - lavc 53.11.0
|
||||
2011-08-16 - 27fbe31 / bca06e7 - lavc 53.11.0
|
||||
Add avcodec_get_type().
|
||||
|
||||
2011-08-06 - 2f63440 - lavf 53.7.0
|
||||
2011-08-06 - 0cb233c / 2f63440 - lavf 53.7.0
|
||||
Add error_recognition to AVFormatContext.
|
||||
|
||||
2011-08-02 - 9d39cbf - lavc 53.9.1
|
||||
2011-08-02 - 1d186e9 / 9d39cbf - lavc 53.9.1
|
||||
Add AV_PKT_FLAG_CORRUPT AVPacket flag.
|
||||
|
||||
2011-07-16 - b57df29 - lavfi 2.27.0
|
||||
@@ -567,11 +567,11 @@ API changes, most recent first:
|
||||
avfilter_set_common_packing_formats()
|
||||
avfilter_all_packing_formats()
|
||||
|
||||
2011-07-10 - a67c061 - lavf 53.6.0
|
||||
2011-07-10 - 3602ad7 / a67c061 - lavf 53.6.0
|
||||
Add avformat_find_stream_info(), deprecate av_find_stream_info().
|
||||
NOTE: this was backported to 0.7
|
||||
|
||||
2011-07-10 - 0b950fe - lavc 53.8.0
|
||||
2011-07-10 - 3602ad7 / 0b950fe - lavc 53.8.0
|
||||
Add avcodec_open2(), deprecate avcodec_open().
|
||||
NOTE: this was backported to 0.7
|
||||
|
||||
@@ -614,35 +614,35 @@ API changes, most recent first:
|
||||
2011-06-12 - 6119b23 - lavfi 2.16.0 - avfilter_graph_parse()
|
||||
Change avfilter_graph_parse() signature.
|
||||
|
||||
2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h
|
||||
2011-06-23 - 686959e / 67e9ae1 - lavu 51.10.0 / 51.8.0 - attributes.h
|
||||
Add av_printf_format().
|
||||
|
||||
2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h
|
||||
2011-06-16 - 2905e3f / 05e84c9, 2905e3f / 25de595 - lavf 53.4.0 / 53.2.0 - avformat.h
|
||||
Add avformat_open_input and avformat_write_header().
|
||||
Deprecate av_open_input_stream, av_open_input_file,
|
||||
AVFormatParameters and av_write_header.
|
||||
|
||||
2011-06-16 - 7e83e1c, dc59ec5 - lavu 51.7.0 - opt.h
|
||||
2011-06-16 - 2905e3f / 7e83e1c, 2905e3f / dc59ec5 - lavu 51.9.0 / 51.7.0 - opt.h
|
||||
Add av_opt_set_dict() and av_opt_find().
|
||||
Deprecate av_find_opt().
|
||||
Add AV_DICT_APPEND flag.
|
||||
|
||||
2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h
|
||||
2011-06-10 - 45fb647 / cb7c11c - lavu 51.6.0 - opt.h
|
||||
Add av_opt_flag_is_set().
|
||||
|
||||
2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
|
||||
Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.
|
||||
|
||||
2011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata
|
||||
2011-06-09 - f9ecb84 / d9f80ea - lavu 51.8.0 - AVMetadata
|
||||
Move AVMetadata from lavf to lavu and rename it to
|
||||
AVDictionary -- new installed header dict.h.
|
||||
All av_metadata_* functions renamed to av_dict_*.
|
||||
|
||||
2011-06-07 - a6703fa - lavu 51.8.0 - av_get_bytes_per_sample()
|
||||
2011-06-07 - d552f61 / a6703fa - lavu 51.8.0 - av_get_bytes_per_sample()
|
||||
Add av_get_bytes_per_sample() in libavutil/samplefmt.h.
|
||||
Deprecate av_get_bits_per_sample_fmt().
|
||||
|
||||
2011-06-05 - b39b062 - lavu 51.8.0 - opt.h
|
||||
2011-06-05 - f956924 / b39b062 - lavu 51.8.0 - opt.h
|
||||
Add av_opt_free convenience function.
|
||||
|
||||
2011-06-06 - 95a0242 - lavfi 2.14.0 - AVFilterBufferRefAudioProps
|
||||
@@ -672,7 +672,7 @@ API changes, most recent first:
|
||||
Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate
|
||||
avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor.
|
||||
|
||||
2011-05-25 - 30315a8 - lavf 53.3.0 - avformat.h
|
||||
2011-05-25 - 39e4206 / 30315a8 - lavf 53.3.0 - avformat.h
|
||||
Add fps_probe_size to AVFormatContext.
|
||||
|
||||
2011-05-22 - 5ecdfd0 - lavf 53.2.0 - avformat.h
|
||||
@@ -688,10 +688,10 @@ API changes, most recent first:
|
||||
2011-05-14 - 9fdf772 - lavfi 2.6.0 - avcodec.h
|
||||
Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h.
|
||||
|
||||
2011-05-18 - 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt
|
||||
2011-05-18 - 75a37b5 / 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt
|
||||
Add request_sample_fmt field to AVCodecContext.
|
||||
|
||||
2011-05-10 - 188dea1 - lavc 53.6.0 - avcodec.h
|
||||
2011-05-10 - 59eb12f / 188dea1 - lavc 53.6.0 - avcodec.h
|
||||
Deprecate AVLPCType and the following fields in
|
||||
AVCodecContext: lpc_coeff_precision, prediction_order_method,
|
||||
min_partition_order, max_partition_order, lpc_type, lpc_passes.
|
||||
@@ -721,81 +721,81 @@ API changes, most recent first:
|
||||
Add av_dynarray_add function for adding
|
||||
an element to a dynamic array.
|
||||
|
||||
2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h
|
||||
2011-04-26 - d7e5aeb / bebe72f - lavu 51.1.0 - avutil.h
|
||||
Add AVPictureType enum and av_get_picture_type_char(), deprecate
|
||||
FF_*_TYPE defines and av_get_pict_type_char() defined in
|
||||
libavcodec/avcodec.h.
|
||||
|
||||
2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h
|
||||
2011-04-26 - d7e5aeb / 10d3940 - lavfi 2.3.0 - avfilter.h
|
||||
Add pict_type and key_frame fields to AVFilterBufferRefVideo.
|
||||
|
||||
2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer
|
||||
2011-04-26 - d7e5aeb / 7a11c82 - lavfi 2.2.0 - vsrc_buffer
|
||||
Add sample_aspect_ratio fields to vsrc_buffer arguments
|
||||
|
||||
2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h
|
||||
2011-04-21 - 8772156 / 94f7451 - lavc 53.1.0 - avcodec.h
|
||||
Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading.
|
||||
|
||||
2011-04-15 - lavc 52.120.0 - avcodec.h
|
||||
AVPacket structure got additional members for passing side information:
|
||||
4de339e introduce side information for AVPacket
|
||||
2d8591c make containers pass palette change in AVPacket
|
||||
c407984 / 4de339e introduce side information for AVPacket
|
||||
c407984 / 2d8591c make containers pass palette change in AVPacket
|
||||
|
||||
2011-04-12 - lavf 52.107.0 - avio.h
|
||||
Avio cleanup, part II - deprecate the entire URLContext API:
|
||||
175389c add avio_check as a replacement for url_exist
|
||||
ff1ec0c add avio_pause and avio_seek_time as replacements
|
||||
c55780d / 175389c add avio_check as a replacement for url_exist
|
||||
9891004 / ff1ec0c add avio_pause and avio_seek_time as replacements
|
||||
for _av_url_read_fseek/fpause
|
||||
cdc6a87 deprecate av_protocol_next(), avio_enum_protocols
|
||||
d4d0932 / cdc6a87 deprecate av_protocol_next(), avio_enum_protocols
|
||||
should be used instead.
|
||||
80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb.
|
||||
f87b1b3 rename open flags: URL_* -> AVIO_*
|
||||
f8270bb add avio_enum_protocols.
|
||||
5593f03 deprecate URLProtocol.
|
||||
c486dad deprecate URLContext.
|
||||
026e175 deprecate the typedef for URLInterruptCB
|
||||
8e76a19 deprecate av_register_protocol2.
|
||||
b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME
|
||||
1305d93 deprecate av_url_read_seek
|
||||
fa104e1 deprecate av_url_read_pause
|
||||
727c7aa deprecate url_get_filename().
|
||||
5958df3 deprecate url_max_packet_size().
|
||||
1869ea0 deprecate url_get_file_handle().
|
||||
32a97d4 deprecate url_filesize().
|
||||
e52a914 deprecate url_close().
|
||||
58a48c6 deprecate url_seek().
|
||||
925e908 deprecate url_write().
|
||||
dce3756 deprecate url_read_complete().
|
||||
bc371ac deprecate url_read().
|
||||
0589da0 deprecate url_open().
|
||||
62eaaea deprecate url_connect.
|
||||
5652bb9 deprecate url_alloc.
|
||||
333e894 deprecate url_open_protocol
|
||||
e230705 deprecate url_poll and URLPollEntry
|
||||
c88caa5 / 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb.
|
||||
c88caa5 / f87b1b3 rename open flags: URL_* -> AVIO_*
|
||||
d4d0932 / f8270bb add avio_enum_protocols.
|
||||
d4d0932 / 5593f03 deprecate URLProtocol.
|
||||
d4d0932 / c486dad deprecate URLContext.
|
||||
d4d0932 / 026e175 deprecate the typedef for URLInterruptCB
|
||||
c88caa5 / 8e76a19 deprecate av_register_protocol2.
|
||||
11d7841 / b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME
|
||||
11d7841 / 1305d93 deprecate av_url_read_seek
|
||||
11d7841 / fa104e1 deprecate av_url_read_pause
|
||||
434f248 / 727c7aa deprecate url_get_filename().
|
||||
434f248 / 5958df3 deprecate url_max_packet_size().
|
||||
434f248 / 1869ea0 deprecate url_get_file_handle().
|
||||
434f248 / 32a97d4 deprecate url_filesize().
|
||||
434f248 / e52a914 deprecate url_close().
|
||||
434f248 / 58a48c6 deprecate url_seek().
|
||||
434f248 / 925e908 deprecate url_write().
|
||||
434f248 / dce3756 deprecate url_read_complete().
|
||||
434f248 / bc371ac deprecate url_read().
|
||||
434f248 / 0589da0 deprecate url_open().
|
||||
434f248 / 62eaaea deprecate url_connect.
|
||||
434f248 / 5652bb9 deprecate url_alloc.
|
||||
434f248 / 333e894 deprecate url_open_protocol
|
||||
434f248 / e230705 deprecate url_poll and URLPollEntry
|
||||
|
||||
2011-04-08 - lavf 52.106.0 - avformat.h
|
||||
Minor avformat.h cleanup:
|
||||
a9bf9d8 deprecate av_guess_image2_codec
|
||||
c3675df rename avf_sdp_create->av_sdp_create
|
||||
d4d0932 / a9bf9d8 deprecate av_guess_image2_codec
|
||||
d4d0932 / c3675df rename avf_sdp_create->av_sdp_create
|
||||
|
||||
2011-04-03 - lavf 52.105.0 - avio.h
|
||||
Large-scale renaming/deprecating of AVIOContext-related functions:
|
||||
724f6a0 deprecate url_fdopen
|
||||
403ee83 deprecate url_open_dyn_packet_buf
|
||||
6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf
|
||||
b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf
|
||||
8978fed introduce an AVIOContext.seekable field as a replacement for
|
||||
2cae980 / 724f6a0 deprecate url_fdopen
|
||||
2cae980 / 403ee83 deprecate url_open_dyn_packet_buf
|
||||
2cae980 / 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf
|
||||
2cae980 / b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf
|
||||
2cae980 / 8978fed introduce an AVIOContext.seekable field as a replacement for
|
||||
AVIOContext.is_streamed and url_is_streamed()
|
||||
b64030f deprecate get_checksum()
|
||||
4c4427a deprecate init_checksum()
|
||||
4ec153b deprecate udp_set_remote_url/get_local_port
|
||||
933e90a deprecate av_url_read_fseek/fpause
|
||||
8d9769a deprecate url_fileno
|
||||
b7f2fdd rename put_flush_packet -> avio_flush
|
||||
35f1023 deprecate url_close_buf
|
||||
83fddae deprecate url_open_buf
|
||||
d9d86e0 rename url_fprintf -> avio_printf
|
||||
59f65d9 deprecate url_setbufsize
|
||||
3e68b3b deprecate url_ferror
|
||||
1caa412 / b64030f deprecate get_checksum()
|
||||
1caa412 / 4c4427a deprecate init_checksum()
|
||||
2fd41c9 / 4ec153b deprecate udp_set_remote_url/get_local_port
|
||||
4fa0e24 / 933e90a deprecate av_url_read_fseek/fpause
|
||||
4fa0e24 / 8d9769a deprecate url_fileno
|
||||
0fecf26 / b7f2fdd rename put_flush_packet -> avio_flush
|
||||
0fecf26 / 35f1023 deprecate url_close_buf
|
||||
0fecf26 / 83fddae deprecate url_open_buf
|
||||
0fecf26 / d9d86e0 rename url_fprintf -> avio_printf
|
||||
0fecf26 / 59f65d9 deprecate url_setbufsize
|
||||
6947b0c / 3e68b3b deprecate url_ferror
|
||||
e8bb2e2 deprecate url_fget_max_packet_size
|
||||
76aa876 rename url_fsize -> avio_size
|
||||
e519753 deprecate url_fgetc
|
||||
@@ -816,7 +816,7 @@ API changes, most recent first:
|
||||
b3db9ce deprecate get_partial_buffer
|
||||
8d9ac96 rename av_alloc_put_byte -> avio_alloc_context
|
||||
|
||||
2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type
|
||||
2011-03-25 - 27ef7b1 / 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type
|
||||
Add audio_service_type field to AVCodecContext.
|
||||
|
||||
2011-03-17 - e309fdc - lavu 50.40.0 - pixfmt.h
|
||||
@@ -854,11 +854,11 @@ API changes, most recent first:
|
||||
2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition
|
||||
Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED.
|
||||
|
||||
2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init()
|
||||
2011-02-09 - c0b102c - lavc 52.112.0 - avcodec_thread_init()
|
||||
Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead
|
||||
set thread_count before calling avcodec_open.
|
||||
|
||||
2011-02-09 - 778b08a - lavc 52.111.0 - threading API
|
||||
2011-02-09 - 37b00b4 - lavc 52.111.0 - threading API
|
||||
Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/
|
||||
release_buffer()/draw_horiz_band() callbacks for appropriate codecs.
|
||||
Add thread_type and active_thread_type fields to AVCodecContext.
|
||||
|
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.1.2
|
||||
PROJECT_NUMBER = 1.1.7
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@@ -92,9 +92,9 @@ uninstall: uninstall-man
|
||||
uninstall-man:
|
||||
$(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
|
||||
|
||||
docclean: clean
|
||||
clean:: docclean
|
||||
|
||||
clean::
|
||||
docclean:
|
||||
$(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 doc/*.3 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi
|
||||
$(RM) -r doc/doxy/html
|
||||
|
||||
|
@@ -60,6 +60,78 @@ This decoder generates wave patterns according to predefined sequences. Its
|
||||
use is purely internal and the format of the data it accepts is not publicly
|
||||
documented.
|
||||
|
||||
@section libcelt
|
||||
|
||||
libcelt decoder wrapper
|
||||
|
||||
libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec.
|
||||
Requires the presence of the libcelt headers and library during configuration.
|
||||
You need to explicitly configure the build with @code{--enable-libcelt}.
|
||||
|
||||
@section libgsm
|
||||
|
||||
libgsm decoder wrapper
|
||||
|
||||
libgsm allows libavcodec to decode the GSM full rate audio codec. Requires
|
||||
the presence of the libgsm headers and library during configuration. You need
|
||||
to explicitly configure the build with @code{--enable-libgsm}.
|
||||
|
||||
This decoder supports both the ordinary GSM and the Microsoft variant.
|
||||
|
||||
@section libilbc
|
||||
|
||||
libilbc decoder wrapper
|
||||
|
||||
libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC)
|
||||
audio codec. Requires the presence of the libilbc headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libilbc}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The following option is supported by the libilbc wrapper.
|
||||
|
||||
@table @option
|
||||
@item enhance
|
||||
|
||||
Enable the enhancement of the decoded audio when set to 1. The default
|
||||
value is 0 (disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@section libopencore-amrnb
|
||||
|
||||
libopencore-amrnb decoder wrapper
|
||||
|
||||
libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate
|
||||
Narrowband audio codec. Using it requires the presence of the
|
||||
libopencore-amrnb headers and library during configuration. You need to
|
||||
explicitly configure the build with @code{--enable-libopencore-amrnb}.
|
||||
|
||||
An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB
|
||||
without this library.
|
||||
|
||||
@section libopencore-amrwb
|
||||
|
||||
libopencore-amrwb decoder wrapper.
|
||||
|
||||
libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate
|
||||
Wideband audio codec. Using it requires the presence of the
|
||||
libopencore-amrwb headers and library during configuration. You need to
|
||||
explicitly configure the build with @code{--enable-libopencore-amrwb}.
|
||||
|
||||
An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB
|
||||
without this library.
|
||||
|
||||
@section libopus
|
||||
|
||||
libopus decoder wrapper.
|
||||
|
||||
libopus allows libavcodec to decode the Opus Interactive Audio Codec.
|
||||
Requires the presence of the libopus headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libopus}.
|
||||
|
||||
@c man end AUDIO DECODERS
|
||||
|
||||
@chapter Subtitles Decoders
|
||||
|
@@ -190,8 +190,8 @@ set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set cindent
|
||||
set cinoptions=(0
|
||||
" allow tabs in Makefiles
|
||||
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=8
|
||||
" Allow tabs in Makefiles.
|
||||
autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8
|
||||
" Trailing whitespace and tabs are forbidden, so highlight them.
|
||||
highlight ForbiddenWhitespace ctermbg=red guibg=red
|
||||
match ForbiddenWhitespace /\s\+$\|\t/
|
||||
|
@@ -25,6 +25,95 @@ enabled encoders.
|
||||
A description of some of the currently available audio encoders
|
||||
follows.
|
||||
|
||||
@anchor{aacenc}
|
||||
@section aac
|
||||
|
||||
Advanced Audio Coding (AAC) encoder.
|
||||
|
||||
This encoder is an experimental FFmpeg-native AAC encoder. Currently only the
|
||||
low complexity (AAC-LC) profile is supported. To use this encoder, you must set
|
||||
@option{strict} option to @samp{experimental} or lower.
|
||||
|
||||
As this encoder is experimental, unexpected behavior may exist from time to
|
||||
time. For a more stable AAC encoder, see @ref{libvo-aacenc}. However, be warned
|
||||
that it has a worse quality reported by some users.
|
||||
|
||||
@c Comment this out until somebody writes the respective documentation.
|
||||
@c See also @ref{libfaac}, @ref{libaacplus}, and @ref{libfdk-aac-enc}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item b
|
||||
Set bit rate in bits/s. Setting this automatically activates constant bit rate
|
||||
(CBR) mode.
|
||||
|
||||
@item q
|
||||
Set quality for variable bit rate (VBR) mode. This option is valid only using
|
||||
the @command{ffmpeg} command-line tool. For library interface users, use
|
||||
@option{global_quality}.
|
||||
|
||||
@item stereo_mode
|
||||
Set stereo encoding mode. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item auto
|
||||
Automatically selected by the encoder.
|
||||
|
||||
@item ms_off
|
||||
Disable middle/side encoding. This is the default.
|
||||
|
||||
@item ms_force
|
||||
Force middle/side encoding.
|
||||
@end table
|
||||
|
||||
@item aac_coder
|
||||
Set AAC encoder coding method. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item 0
|
||||
FAAC-inspired method.
|
||||
|
||||
This method is a simplified reimplementation of the method used in FAAC, which
|
||||
sets thresholds proportional to the band energies, and then decreases all the
|
||||
thresholds with quantizer steps to find the appropriate quantization with
|
||||
distortion below threshold band by band.
|
||||
|
||||
The quality of this method is comparable to the two loop searching method
|
||||
descibed below, but somewhat a little better and slower.
|
||||
|
||||
@item 1
|
||||
Average noise to mask ratio (ANMR) trellis-based solution.
|
||||
|
||||
This has a theoretic best quality out of all the coding methods, but at the
|
||||
cost of the slowest speed.
|
||||
|
||||
@item 2
|
||||
Two loop searching (TLS) method.
|
||||
|
||||
This method first sets quantizers depending on band thresholds and then tries
|
||||
to find an optimal combination by adding or subtracting a specific value from
|
||||
all quantizers and adjusting some individual quantizer a little.
|
||||
|
||||
This method produces similar quality with the FAAC method and is the default.
|
||||
|
||||
@item 3
|
||||
Constant quantizer method.
|
||||
|
||||
This method sets a constant quantizer for all bands. This is the fastest of all
|
||||
the methods, yet produces the worst quality.
|
||||
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@subsection Tips and Tricks
|
||||
|
||||
According to some reports
|
||||
(e.g. @url{http://d.hatena.ne.jp/kamedo2/20120729/1343545890}), setting the
|
||||
@option{cutoff} option to 15000 Hz greatly improves the quality of the output
|
||||
quality. As a result, we encourage you to do the same.
|
||||
|
||||
@section ac3 and ac3_fixed
|
||||
|
||||
AC-3 audio encoders.
|
||||
@@ -412,6 +501,279 @@ Selected by Encoder (default)
|
||||
|
||||
@end table
|
||||
|
||||
@section libmp3lame
|
||||
|
||||
LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper
|
||||
|
||||
Requires the presence of the libmp3lame headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libmp3lame}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The following options are supported by the libmp3lame wrapper. The
|
||||
@command{lame}-equivalent of the options are listed in parentheses.
|
||||
|
||||
@table @option
|
||||
@item b (@emph{-b})
|
||||
Set bitrate expressed in bits/s for CBR. LAME @code{bitrate} is
|
||||
expressed in kilobits/s.
|
||||
|
||||
@item q (@emph{-V})
|
||||
Set constant quality setting for VBR. This option is valid only
|
||||
using the @command{ffmpeg} command-line tool. For library interface
|
||||
users, use @option{global_quality}.
|
||||
|
||||
@item compression_level (@emph{-q})
|
||||
Set algorithm quality. Valid arguments are integers in the 0-9 range,
|
||||
with 0 meaning highest quality but slowest, and 9 meaning fastest
|
||||
while producing the worst quality.
|
||||
|
||||
@item reservoir
|
||||
Enable use of bit reservoir when set to 1. Default value is 1. LAME
|
||||
has this enabled by default, but can be overriden by use
|
||||
@option{--nores} option.
|
||||
|
||||
@end table
|
||||
|
||||
@section libopencore-amrnb
|
||||
|
||||
OpenCORE Adaptive Multi-Rate Narrowband encoder.
|
||||
|
||||
Requires the presence of the libopencore-amrnb headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libopencore-amrnb --enable-version3}.
|
||||
|
||||
This is a mono-only encoder. Officially it only supports 8000Hz sample rate,
|
||||
but you can override it by setting @option{strict} to @samp{unofficial} or
|
||||
lower.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item b
|
||||
Set bitrate in bits per second. Only the following bitrates are supported,
|
||||
otherwise libavcodec will round to the nearest valid bitrate.
|
||||
|
||||
@table @option
|
||||
@item 4750
|
||||
@item 5150
|
||||
@item 5900
|
||||
@item 6700
|
||||
@item 7400
|
||||
@item 7950
|
||||
@item 10200
|
||||
@item 12200
|
||||
@end table
|
||||
|
||||
@item dtx
|
||||
Allow discontinuous transmission (generate comfort noise) when set to 1. The
|
||||
default value is 0 (disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@section libtwolame
|
||||
|
||||
TwoLAME MP2 encoder wrapper
|
||||
|
||||
Requires the presence of the libtwolame headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libtwolame}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The following options are supported by the libtwolame wrapper. The
|
||||
@command{twolame}-equivalent options follow the FFmpeg ones and are in
|
||||
parentheses.
|
||||
|
||||
@table @option
|
||||
@item b (@emph{-b})
|
||||
Set bitrate expressed in bits/s for CBR. @command{twolame} @option{b}
|
||||
option is expressed in kilobits/s. Default value is 128k.
|
||||
|
||||
@item q (@emph{-V})
|
||||
Set quality for experimental VBR support. Maximum value range is
|
||||
from -50 to 50, useful range is from -10 to 10. The higher the
|
||||
value, the better the quality. This option is valid only using the
|
||||
@command{ffmpeg} command-line tool. For library interface users,
|
||||
use @option{global_quality}.
|
||||
|
||||
@item mode (@emph{--mode})
|
||||
Set the mode of the resulting audio. Possible values:
|
||||
|
||||
@table @samp
|
||||
@item auto
|
||||
Choose mode automatically based on the input. This is the default.
|
||||
@item stereo
|
||||
Stereo
|
||||
@item joint_stereo
|
||||
Joint stereo
|
||||
@item dual_channel
|
||||
Dual channel
|
||||
@item mono
|
||||
Mono
|
||||
@end table
|
||||
|
||||
@item psymodel (@emph{--psyc-mode})
|
||||
Set psychoacoustic model to use in encoding. The argument must be
|
||||
an integer between -1 and 4, inclusive. The higher the value, the
|
||||
better the quality. The default value is 3.
|
||||
|
||||
@item energy_levels (@emph{--energy})
|
||||
Enable energy levels extensions when set to 1. The default value is
|
||||
0 (disabled).
|
||||
|
||||
@item error_protection (@emph{--protect})
|
||||
Enable CRC error protection when set to 1. The default value is 0
|
||||
(disabled).
|
||||
|
||||
@item copyright (@emph{--copyright})
|
||||
Set MPEG audio copyright flag when set to 1. The default value is 0
|
||||
(disabled).
|
||||
|
||||
@item original (@emph{--original})
|
||||
Set MPEG audio original flag when set to 1. The default value is 0
|
||||
(disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@anchor{libvo-aacenc}
|
||||
@section libvo-aacenc
|
||||
|
||||
VisualOn AAC encoder
|
||||
|
||||
Requires the presence of the libvo-aacenc headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libvo-aacenc --enable-version3}.
|
||||
|
||||
This encoder is considered to be worse than the
|
||||
@ref{aacenc,,native experimental FFmpeg AAC encoder}, according to
|
||||
multiple sources.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The VisualOn AAC encoder only support encoding AAC-LC and up to 2
|
||||
channels. It is also CBR-only.
|
||||
|
||||
@table @option
|
||||
|
||||
@item b
|
||||
Set bit rate in bits/s.
|
||||
|
||||
@end table
|
||||
|
||||
@section libvo-amrwbenc
|
||||
|
||||
VisualOn Adaptive Multi-Rate Wideband encoder
|
||||
|
||||
Requires the presence of the libvo-amrwbenc headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libvo-amrwbenc --enable-version3}.
|
||||
|
||||
This is a mono-only encoder. Officially it only supports 16000Hz sample
|
||||
rate, but you can override it by setting @option{strict} to
|
||||
@samp{unofficial} or lower.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item b
|
||||
Set bitrate in bits/s. Only the following bitrates are supported, otherwise
|
||||
libavcodec will round to the nearest valid bitrate.
|
||||
|
||||
@table @samp
|
||||
@item 6600
|
||||
@item 8850
|
||||
@item 12650
|
||||
@item 14250
|
||||
@item 15850
|
||||
@item 18250
|
||||
@item 19850
|
||||
@item 23050
|
||||
@item 23850
|
||||
@end table
|
||||
|
||||
@item dtx
|
||||
Allow discontinuous transmission (generate comfort noise) when set to 1. The
|
||||
default value is 0 (disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@section libopus
|
||||
|
||||
libopus Opus Interactive Audio Codec encoder wrapper.
|
||||
|
||||
Requires the presence of the libopus headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libopus}.
|
||||
|
||||
@subsection Option Mapping
|
||||
|
||||
Most libopus options are modeled after the @command{opusenc} utility from
|
||||
opus-tools. The following is an option mapping chart describing options
|
||||
supported by the libopus wrapper, and their @command{opusenc}-equivalent
|
||||
in parentheses.
|
||||
|
||||
@table @option
|
||||
|
||||
@item b (@emph{bitrate})
|
||||
Set the bit rate in bits/s. FFmpeg's @option{b} option is
|
||||
expressed in bits/s, while @command{opusenc}'s @option{bitrate} in
|
||||
kilobits/s.
|
||||
|
||||
@item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr})
|
||||
Set VBR mode. The FFmpeg @option{vbr} option has the following
|
||||
valid arguments, with the their @command{opusenc} equivalent options
|
||||
in parentheses:
|
||||
|
||||
@table @samp
|
||||
@item off (@emph{hard-cbr})
|
||||
Use constant bit rate encoding.
|
||||
|
||||
@item on (@emph{vbr})
|
||||
Use variable bit rate encoding (the default).
|
||||
|
||||
@item constrained (@emph{cvbr})
|
||||
Use constrained variable bit rate encoding.
|
||||
@end table
|
||||
|
||||
@item compression_level (@emph{comp})
|
||||
Set encoding algorithm complexity. Valid options are integers in
|
||||
the 0-10 range. 0 gives the fastest encodes but lower quality, while 10
|
||||
gives the highest quality but slowest encoding. The default is 10.
|
||||
|
||||
@item frame_duration (@emph{framesize})
|
||||
Set maximum frame size, or duration of a frame in milliseconds. The
|
||||
argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller
|
||||
frame sizes achieve lower latency but less quality at a given bitrate.
|
||||
Sizes greater than 20ms are only interesting at fairly low bitrates.
|
||||
The default of FFmpeg is 10ms, but is 20ms in @command{opusenc}.
|
||||
|
||||
@item packet_loss (@emph{expect-loss})
|
||||
Set expected packet loss percentage. The default is 0.
|
||||
|
||||
@item application (N.A.)
|
||||
Set intended application type. Valid options are listed below:
|
||||
|
||||
@table @samp
|
||||
@item voip
|
||||
Favor improved speech intelligibility.
|
||||
@item audio
|
||||
Favor faithfulness to the input (the default).
|
||||
@item lowdelay
|
||||
Restrict to only the lowest delay modes.
|
||||
@end table
|
||||
|
||||
@item cutoff (N.A.)
|
||||
Set cutoff bandwidth in Hz. The argument must be exactly one of the
|
||||
following: 4000, 6000, 8000, 12000, or 20000, corresponding to
|
||||
narrowband, mediumband, wideband, super wideband, and fullband
|
||||
respectively. The default is 0 (cutoff disabled).
|
||||
|
||||
@end table
|
||||
|
||||
@c man end AUDIO ENCODERS
|
||||
|
||||
@chapter Video Encoders
|
||||
@@ -633,4 +995,117 @@ ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
|
||||
For more information about libx264 and the supported options see:
|
||||
@url{http://www.videolan.org/developers/x264.html}
|
||||
|
||||
@section libxvid
|
||||
|
||||
Xvid MPEG-4 Part 2 encoder wrapper.
|
||||
|
||||
This encoder requires the presence of the libxvidcore headers and library
|
||||
during configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libxvid --enable-gpl}.
|
||||
|
||||
The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
|
||||
users can encode to this format without this library.
|
||||
|
||||
@subsection Options
|
||||
|
||||
The following options are supported by the libxvid wrapper. Some of
|
||||
the following options are listed but are not documented, and
|
||||
correspond to shared codec options. See @ref{codec-options,,the Codec
|
||||
Options chapter} for their documentation. The other shared options
|
||||
which are not listed have no effect for the libxvid encoder.
|
||||
|
||||
@table @option
|
||||
@item b
|
||||
|
||||
@item g
|
||||
|
||||
@item qmin
|
||||
|
||||
@item qmax
|
||||
|
||||
@item mpeg_quant
|
||||
|
||||
@item threads
|
||||
|
||||
@item bf
|
||||
|
||||
@item b_qfactor
|
||||
|
||||
@item b_qoffset
|
||||
|
||||
@item flags
|
||||
Set specific encoding flags. Possible values:
|
||||
|
||||
@table @samp
|
||||
|
||||
@item mv4
|
||||
Use four motion vector by macroblock.
|
||||
|
||||
@item aic
|
||||
Enable high quality AC prediction.
|
||||
|
||||
@item gray
|
||||
Only encode grayscale.
|
||||
|
||||
@item gmc
|
||||
Enable the use of global motion compensation (GMC).
|
||||
|
||||
@item qpel
|
||||
Enable quarter-pixel motion compensation.
|
||||
|
||||
@item cgop
|
||||
Enable closed GOP.
|
||||
|
||||
@item global_header
|
||||
Place global headers in extradata instead of every keyframe.
|
||||
|
||||
@end table
|
||||
|
||||
@item trellis
|
||||
|
||||
@item me_method
|
||||
Set motion estimation method. Possible values in decreasing order of
|
||||
speed and increasing order of quality:
|
||||
|
||||
@table @samp
|
||||
@item zero
|
||||
Use no motion estimation (default).
|
||||
|
||||
@item phods
|
||||
@item x1
|
||||
@item log
|
||||
Enable advanced diamond zonal search for 16x16 blocks and half-pixel
|
||||
refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
|
||||
@samp{phods}.
|
||||
|
||||
@item epzs
|
||||
Enable all of the things described above, plus advanced diamond zonal
|
||||
search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
|
||||
estimation on chroma planes.
|
||||
|
||||
@item full
|
||||
Enable all of the things described above, plus extended 16x16 and 8x8
|
||||
blocks search.
|
||||
@end table
|
||||
|
||||
@item mbd
|
||||
Set macroblock decision algorithm. Possible values in the increasing
|
||||
order of quality:
|
||||
|
||||
@table @samp
|
||||
@item simple
|
||||
Use macroblock comparing function algorithm (default).
|
||||
|
||||
@item bits
|
||||
Enable rate distortion-based half pixel and quarter pixel refinement for
|
||||
16x16 blocks.
|
||||
|
||||
@item rd
|
||||
Enable all of the things described above, plus rate distortion-based
|
||||
half pixel and quarter pixel refinement for 8x8 blocks, and rate
|
||||
distortion-based search using square pattern.
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@c man end VIDEO ENCODERS
|
||||
|
@@ -17,6 +17,7 @@ the libavcodec library.
|
||||
|
||||
@c man end DESCRIPTION
|
||||
|
||||
@anchor{codec-options}
|
||||
@chapter Codec Options
|
||||
@c man begin CODEC OPTIONS
|
||||
|
||||
|
@@ -140,6 +140,12 @@ Use wallclock as timestamps.
|
||||
@item avoid_negative_ts @var{integer} (@emph{output})
|
||||
Shift timestamps to make them positive. 1 enables, 0 disables, default
|
||||
of -1 enables when required by target format.
|
||||
|
||||
@item skip_initial_bytes @var{integer} (@emph{input})
|
||||
Set number initial bytes to skip. Default is 0.
|
||||
|
||||
@item correct_ts_overflow @var{integer} (@emph{input})
|
||||
Correct single timestamp overflows if set to 1. Default is 1.
|
||||
@end table
|
||||
|
||||
@c man end FORMAT OPTIONS
|
||||
|
@@ -978,7 +978,7 @@ ffmpeg -filter_complex 'color=red' -t 5 out.mkv
|
||||
|
||||
As a special exception, you can use a bitmap subtitle stream as input: it
|
||||
will be converted into a video with the same size as the largest video in
|
||||
the file, or 720×576 if no video is present. Note that this is an
|
||||
the file, or 720x576 if no video is present. Note that this is an
|
||||
experimental and temporary solution. It will be removed once libavfilter has
|
||||
proper support for subtitles.
|
||||
|
||||
|
@@ -3,10 +3,10 @@
|
||||
|
||||
Filtering in FFmpeg is enabled through the libavfilter library.
|
||||
|
||||
In libavfilter, it is possible for filters to have multiple inputs and
|
||||
multiple outputs.
|
||||
To illustrate the sorts of things that are possible, we can
|
||||
use a complex filter graph. For example, the following one:
|
||||
In libavfilter, a filter can have multiple inputs and multiple
|
||||
outputs.
|
||||
To illustrate the sorts of things that are possible, we consider the
|
||||
following filtergraph.
|
||||
|
||||
@example
|
||||
input --> split ---------------------> overlay --> output
|
||||
@@ -15,25 +15,32 @@ input --> split ---------------------> overlay --> output
|
||||
+-----> crop --> vflip -------+
|
||||
@end example
|
||||
|
||||
splits the stream in two streams, sends one stream through the crop filter
|
||||
and the vflip filter before merging it back with the other stream by
|
||||
overlaying it on top. You can use the following command to achieve this:
|
||||
This filtergraph splits the input stream in two streams, sends one
|
||||
stream through the crop filter and the vflip filter before merging it
|
||||
back with the other stream by overlaying it on top. You can use the
|
||||
following command to achieve this:
|
||||
|
||||
@example
|
||||
ffmpeg -i input -vf "[in] split [T1], [T2] overlay=0:H/2 [out]; [T1] crop=iw:ih/2:0:ih/2, vflip [T2]" output
|
||||
ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
|
||||
@end example
|
||||
|
||||
The result will be that in output the top half of the video is mirrored
|
||||
onto the bottom half.
|
||||
|
||||
Filters are loaded using the @var{-vf} or @var{-af} option passed to
|
||||
@command{ffmpeg} or to @command{ffplay}. Filters in the same linear
|
||||
chain are separated by commas. In our example, @var{split,
|
||||
overlay} are in one linear chain, and @var{crop, vflip} are in
|
||||
another. The points where the linear chains join are labeled by names
|
||||
enclosed in square brackets. In our example, that is @var{[T1]} and
|
||||
@var{[T2]}. The special labels @var{[in]} and @var{[out]} are the points
|
||||
where video is input and output.
|
||||
Filters in the same linear chain are separated by commas, and distinct
|
||||
linear chains of filters are separated by semicolons. In our example,
|
||||
@var{crop,vflip} are in one linear chain, @var{split} and
|
||||
@var{overlay} are separately in another. The points where the linear
|
||||
chains join are labelled by names enclosed in square brackets. In the
|
||||
example, the split filter generates two outputs that are associated to
|
||||
the labels @var{[main]} and @var{[tmp]}.
|
||||
|
||||
The stream sent to the second output of @var{split}, labelled as
|
||||
@var{[tmp]}, is processed through the @var{crop} filter, which crops
|
||||
away the lower half part of the video, and then vertically flipped. The
|
||||
@var{overlay} filter takes in input the first unchanged output of the
|
||||
split filter (which was labelled as @var{[main]}), and overlay on its
|
||||
lower half the output generated by the @var{crop,vflip} filterchain.
|
||||
|
||||
Some filters take in input a list of parameters: they are specified
|
||||
after the filter name and an equal sign, and are separated from each other
|
||||
@@ -179,7 +186,7 @@ Follows a BNF description for the filtergraph syntax:
|
||||
@var{LINKLABEL} ::= "[" @var{NAME} "]"
|
||||
@var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
|
||||
@var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
|
||||
@var{FILTER} ::= [@var{LINKNAMES}] @var{NAME} ["=" @var{ARGUMENTS}] [@var{LINKNAMES}]
|
||||
@var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
|
||||
@var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
|
||||
@var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
|
||||
@end example
|
||||
@@ -4149,7 +4156,7 @@ Alternatively, the options can be specified as a flat string:
|
||||
|
||||
@var{layout}[:@var{nb_frames}[:@var{margin}[:@var{padding}]]]
|
||||
|
||||
For example, produce 8×8 PNG tiles of all keyframes (@option{-skip_frame
|
||||
For example, produce 8x8 PNG tiles of all keyframes (@option{-skip_frame
|
||||
nokey}) in a movie:
|
||||
@example
|
||||
ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
|
||||
@@ -5543,7 +5550,7 @@ Activate unsafe mode: do not fail if segments have a different format.
|
||||
The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
|
||||
@var{a} audio outputs.
|
||||
|
||||
There are @var{n}×(@var{v}+@var{a}) inputs: first the inputs for the first
|
||||
There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
|
||||
segment, in the same order as the outputs, then the inputs for the second
|
||||
segment, etc.
|
||||
|
||||
|
@@ -24,7 +24,7 @@ instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjp
|
||||
@file{./configure}.
|
||||
|
||||
|
||||
@section OpenCORE and VisualOn libraries
|
||||
@section OpenCORE, VisualOn, and Fraunhofer libraries
|
||||
|
||||
Spun off Google Android sources, OpenCore, VisualOn and Fraunhofer
|
||||
libraries provide encoders for a number of audio codecs.
|
||||
@@ -32,9 +32,14 @@ libraries provide encoders for a number of audio codecs.
|
||||
@float NOTE
|
||||
OpenCORE and VisualOn libraries are under the Apache License 2.0
|
||||
(see @url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is
|
||||
incompatible with the LGPL version 2.1 and GPL version 2. You have to
|
||||
incompatible to the LGPL version 2.1 and GPL version 2. You have to
|
||||
upgrade FFmpeg's license to LGPL version 3 (or if you have enabled
|
||||
GPL components, GPL version 3) to use it.
|
||||
GPL components, GPL version 3) by passing @code{--enable-version3} to configure in
|
||||
order to use it.
|
||||
|
||||
The Fraunhofer AAC library is licensed under a license incompatible to the GPL
|
||||
and is not known to be compatible to the LGPL. Therefore, you have to pass
|
||||
@code{--enable-nonfree} to configure to use it.
|
||||
@end float
|
||||
|
||||
@subsection OpenCORE AMR
|
||||
|
@@ -24,7 +24,7 @@ a mail for every change to every issue.
|
||||
The subscription URL for the ffmpeg-trac list is:
|
||||
http(s)://ffmpeg.org/mailman/listinfo/ffmpeg-trac
|
||||
The URL of the webinterface of the tracker is:
|
||||
http(s)://ffmpeg.org/trac/ffmpeg
|
||||
http(s)://trac.ffmpeg.org
|
||||
|
||||
Type:
|
||||
-----
|
||||
|
@@ -18,6 +18,23 @@ enabled muxers.
|
||||
|
||||
A description of some of the currently available muxers follows.
|
||||
|
||||
@anchor{aiff}
|
||||
@section aiff
|
||||
|
||||
Audio Interchange File Format muxer.
|
||||
|
||||
It accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item write_id3v2
|
||||
Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
|
||||
|
||||
@item id3v2_version
|
||||
Select ID3v2 version to write. Currently only version 3 and 4 (aka.
|
||||
ID3v2.3 and ID3v2.4) are supported. The default is version 4.
|
||||
|
||||
@end table
|
||||
|
||||
@anchor{crc}
|
||||
@section crc
|
||||
|
||||
|
@@ -121,7 +121,7 @@ INF: while(<$inf>) {
|
||||
$chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name);
|
||||
|
||||
# start new chapter
|
||||
$chapter_name = $1, push (@chapters_sequence, $chapter_name);
|
||||
$chapter_name = $1, push (@chapters_sequence, $chapter_name) unless $skipping;
|
||||
$chapters{$chapter_name} = "" unless exists $chapters{$chapter_name};
|
||||
$chapter = "";
|
||||
$output = 1;
|
||||
@@ -169,7 +169,7 @@ INF: while(<$inf>) {
|
||||
} elsif ($ended =~ /^(?:example|smallexample|display)$/) {
|
||||
$shift = "";
|
||||
$_ = ""; # need a paragraph break
|
||||
} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
|
||||
} elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) {
|
||||
$_ = "\n=back\n";
|
||||
$ic = pop @icstack;
|
||||
} else {
|
||||
@@ -269,7 +269,7 @@ INF: while(<$inf>) {
|
||||
$endw = "enumerate";
|
||||
};
|
||||
|
||||
/^\@([fv]?table)\s+(\@[a-z]+)/ and do {
|
||||
/^\@((?:multi|[fv])?table)\s+(\@[a-z]+)/ and do {
|
||||
push @endwstack, $endw;
|
||||
push @icstack, $ic;
|
||||
$endw = $1;
|
||||
@@ -278,6 +278,7 @@ INF: while(<$inf>) {
|
||||
$ic =~ s/\@(?:code|kbd)/C/;
|
||||
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
|
||||
$ic =~ s/\@(?:file)/F/;
|
||||
$ic =~ s/\@(?:columnfractions)//;
|
||||
$_ = "\n=over 4\n";
|
||||
};
|
||||
|
||||
@@ -288,6 +289,21 @@ INF: while(<$inf>) {
|
||||
$_ = ""; # need a paragraph break
|
||||
};
|
||||
|
||||
/^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
|
||||
my $columns = $1;
|
||||
$columns =~ s/\@tab/ : /;
|
||||
|
||||
$_ = "\n=item B<". $columns .">\n";
|
||||
};
|
||||
|
||||
/^\@tab\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
|
||||
my $columns = $1;
|
||||
$columns =~ s/\@tab/ : /;
|
||||
|
||||
$_ = " : ". $columns;
|
||||
$chapter =~ s/\n+\s+$//;
|
||||
};
|
||||
|
||||
/^\@itemx?\s*(.+)?$/ and do {
|
||||
if (defined $1) {
|
||||
# Entity escapes prevent munging by the <> processing below.
|
||||
@@ -361,6 +377,7 @@ sub postprocess
|
||||
s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
|
||||
s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
|
||||
s/;\s+\@pxref\{(?:[^\}]*)\}//g;
|
||||
s/\@ref\{(?:[^,\}]*,)(?:[^,\}]*,)([^,\}]*).*\}/$1/g;
|
||||
s/\@ref\{([^\}]*)\}/$1/g;
|
||||
s/\@noindent\s*//g;
|
||||
s/\@refill//g;
|
||||
|
7
ffmpeg.c
7
ffmpeg.c
@@ -152,6 +152,8 @@ static struct termios oldtty;
|
||||
static int restore_tty;
|
||||
#endif
|
||||
|
||||
static void free_input_threads(void);
|
||||
|
||||
|
||||
/* sub2video hack:
|
||||
Convert subtitles to video with alpha to insert them in filter graphs.
|
||||
@@ -441,6 +443,9 @@ static void exit_program(void)
|
||||
av_freep(&output_streams[i]->logfile_prefix);
|
||||
av_freep(&output_streams[i]);
|
||||
}
|
||||
#if HAVE_PTHREADS
|
||||
free_input_threads();
|
||||
#endif
|
||||
for (i = 0; i < nb_input_files; i++) {
|
||||
avformat_close_input(&input_files[i]->ctx);
|
||||
av_freep(&input_files[i]);
|
||||
@@ -1654,7 +1659,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
|
||||
|
||||
if (!frame_sample_aspect->num)
|
||||
*frame_sample_aspect = ist->st->sample_aspect_ratio;
|
||||
if (ist->dr1 && decoded_frame->type==FF_BUFFER_TYPE_USER && !changed) {
|
||||
if (ist->dr1 && decoded_frame->type==FF_BUFFER_TYPE_USER && !changed && !do_deinterlace) {
|
||||
FrameBuffer *buf = decoded_frame->opaque;
|
||||
AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays(
|
||||
decoded_frame->data, decoded_frame->linesize,
|
||||
|
@@ -328,6 +328,14 @@ static AVLFG random_state;
|
||||
|
||||
static FILE *logfile = NULL;
|
||||
|
||||
static void htmlstrip(char *s) {
|
||||
while (s && *s) {
|
||||
s += strspn(s, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. ");
|
||||
if (*s)
|
||||
*s++ = '?';
|
||||
}
|
||||
}
|
||||
|
||||
static int64_t ffm_read_write_index(int fd)
|
||||
{
|
||||
uint8_t buf[8];
|
||||
@@ -1887,6 +1895,7 @@ static int http_parse_request(HTTPContext *c)
|
||||
send_error:
|
||||
c->http_error = 404;
|
||||
q = c->buffer;
|
||||
htmlstrip(msg);
|
||||
snprintf(q, c->buffer_size,
|
||||
"HTTP/1.0 404 Not Found\r\n"
|
||||
"Content-type: text/html\r\n"
|
||||
|
132
libavcodec/4xm.c
132
libavcodec/4xm.c
@@ -328,12 +328,12 @@ static inline void mcdc(uint16_t *dst, const uint16_t *src, int log2w,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_assert2(0);
|
||||
av_assert0(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
|
||||
int log2w, int log2h, int stride)
|
||||
static int decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
|
||||
int log2w, int log2h, int stride)
|
||||
{
|
||||
const int index = size2index[log2h][log2w];
|
||||
const int h = 1 << log2h;
|
||||
@@ -342,57 +342,72 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
|
||||
BLOCK_TYPE_VLC_BITS, 1);
|
||||
uint16_t *start = (uint16_t *)f->last_picture.data[0];
|
||||
uint16_t *end = start + stride * (f->avctx->height - h + 1) - (1 << log2w);
|
||||
int ret;
|
||||
|
||||
av_assert2(code >= 0 && code <= 6);
|
||||
av_assert0(code >= 0 && code <= 6 && log2w >= 0);
|
||||
|
||||
if (code == 0) {
|
||||
if (bytestream2_get_bytes_left(&f->g) < 1) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
src += f->mv[bytestream2_get_byteu(&f->g)];
|
||||
if (start > src || src > end) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mcdc(dst, src, log2w, h, stride, 1, 0);
|
||||
} else if (code == 1) {
|
||||
log2h--;
|
||||
decode_p_block(f, dst, src, log2w, log2h, stride);
|
||||
decode_p_block(f, dst + (stride << log2h),
|
||||
src + (stride << log2h), log2w, log2h, stride);
|
||||
if ((ret = decode_p_block(f, dst, src, log2w, log2h, stride)) < 0)
|
||||
return ret;
|
||||
if ((ret = decode_p_block(f, dst + (stride << log2h),
|
||||
src + (stride << log2h),
|
||||
log2w, log2h, stride)) < 0)
|
||||
return ret;
|
||||
} else if (code == 2) {
|
||||
log2w--;
|
||||
decode_p_block(f, dst , src, log2w, log2h, stride);
|
||||
decode_p_block(f, dst + (1 << log2w),
|
||||
src + (1 << log2w), log2w, log2h, stride);
|
||||
if ((ret = decode_p_block(f, dst , src, log2w, log2h, stride)) < 0)
|
||||
return ret;
|
||||
if ((ret = decode_p_block(f, dst + (1 << log2w),
|
||||
src + (1 << log2w),
|
||||
log2w, log2h, stride)) < 0)
|
||||
return ret;
|
||||
} else if (code == 3 && f->version < 2) {
|
||||
if (start > src || src > end) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mcdc(dst, src, log2w, h, stride, 1, 0);
|
||||
} else if (code == 4) {
|
||||
if (bytestream2_get_bytes_left(&f->g) < 1) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
src += f->mv[bytestream2_get_byteu(&f->g)];
|
||||
if (start > src || src > end) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (bytestream2_get_bytes_left(&f->g2) < 2){
|
||||
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mcdc(dst, src, log2w, h, stride, 1, bytestream2_get_le16u(&f->g2));
|
||||
} else if (code == 5) {
|
||||
if (bytestream2_get_bytes_left(&f->g2) < 2) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (start > src || src > end) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16u(&f->g2));
|
||||
} else if (code == 6) {
|
||||
if (bytestream2_get_bytes_left(&f->g2) < 4) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
|
||||
return;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (log2w) {
|
||||
dst[0] = bytestream2_get_le16u(&f->g2);
|
||||
@@ -402,6 +417,7 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
|
||||
dst[stride] = bytestream2_get_le16u(&f->g2);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
@@ -414,8 +430,20 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
const int stride = f->current_picture.linesize[0] >> 1;
|
||||
unsigned int bitstream_size, bytestream_size, wordstream_size, extra,
|
||||
bytestream_offset, wordstream_offset;
|
||||
int ret;
|
||||
|
||||
if (!f->last_picture.data[0]) {
|
||||
if ((ret = ff_get_buffer(f->avctx, &f->last_picture)) < 0) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return ret;
|
||||
}
|
||||
for (y=0; y<f->avctx->height; y++)
|
||||
memset(f->last_picture.data[0] + y*f->last_picture.linesize[0], 0, 2*f->avctx->width);
|
||||
}
|
||||
|
||||
if (f->version > 1) {
|
||||
if (length < 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
extra = 20;
|
||||
if (length < extra)
|
||||
return -1;
|
||||
@@ -459,7 +487,8 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
|
||||
for (y = 0; y < height; y += 8) {
|
||||
for (x = 0; x < width; x += 8)
|
||||
decode_p_block(f, dst + x, src + x, 3, 3, stride);
|
||||
if ((ret = decode_p_block(f, dst + x, src + x, 3, 3, stride)) < 0)
|
||||
return ret;
|
||||
src += 8 * stride;
|
||||
dst += 8 * stride;
|
||||
}
|
||||
@@ -579,7 +608,8 @@ static int decode_i_mb(FourXContext *f)
|
||||
}
|
||||
|
||||
static const uint8_t *read_huffman_tables(FourXContext *f,
|
||||
const uint8_t * const buf, int buf_size)
|
||||
const uint8_t * const buf,
|
||||
int buf_size)
|
||||
{
|
||||
int frequency[512] = { 0 };
|
||||
uint8_t flag[512];
|
||||
@@ -598,8 +628,11 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
|
||||
for (;;) {
|
||||
int i;
|
||||
|
||||
if (start <= end && ptr_end - ptr < end - start + 1 + 1)
|
||||
if (ptr_end - ptr < FFMAX(end - start + 1, 0) + 1) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "invalid data in read_huffman_tables\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = start; i <= end; i++)
|
||||
frequency[i] = *ptr++;
|
||||
start = *ptr++;
|
||||
@@ -701,9 +734,9 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
color[1] = bytestream2_get_le16u(&g3);
|
||||
|
||||
if (color[0] & 0x8000)
|
||||
av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");
|
||||
av_log(f->avctx, AV_LOG_ERROR, "unk bit 1\n");
|
||||
if (color[1] & 0x8000)
|
||||
av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");
|
||||
av_log(f->avctx, AV_LOG_ERROR, "unk bit 2\n");
|
||||
|
||||
color[2] = mix(color[0], color[1]);
|
||||
color[3] = mix(color[1], color[0]);
|
||||
@@ -732,7 +765,10 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
unsigned int prestream_size;
|
||||
const uint8_t *prestream;
|
||||
|
||||
if (bitstream_size > (1<<26) || length < bitstream_size + 12) {
|
||||
if (bitstream_size > (1 << 26))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (length < bitstream_size + 12) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -741,16 +777,17 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
|
||||
prestream = buf + bitstream_size + 12;
|
||||
|
||||
if (prestream_size + bitstream_size + 12 != length
|
||||
|| bitstream_size > (1 << 26)
|
||||
|| prestream_size > (1 << 26)) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n",
|
||||
prestream_size, bitstream_size, length);
|
||||
return -1;
|
||||
}
|
||||
|
||||
prestream = read_huffman_tables(f, prestream, buf + length - prestream);
|
||||
if (!prestream)
|
||||
return -1;
|
||||
prestream = read_huffman_tables(f, prestream, prestream_size);
|
||||
if (!prestream) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
init_get_bits(&f->gb, buf + 4, 8 * bitstream_size);
|
||||
|
||||
@@ -793,30 +830,38 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
AVFrame *p, temp;
|
||||
int i, frame_4cc, frame_size;
|
||||
|
||||
if (buf_size < 12)
|
||||
if (buf_size < 20)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame_4cc = AV_RL32(buf);
|
||||
if (buf_size != AV_RL32(buf + 4) + 8 || buf_size < 20)
|
||||
|
||||
av_assert0(avctx->width % 16 == 0 && avctx->height % 16 == 0);
|
||||
|
||||
if (buf_size < AV_RL32(buf + 4) + 8) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n",
|
||||
buf_size, AV_RL32(buf + 4));
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
frame_4cc = AV_RL32(buf);
|
||||
|
||||
if (frame_4cc == AV_RL32("cfrm")) {
|
||||
int free_index = -1;
|
||||
int id, whole_size;
|
||||
const int data_size = buf_size - 20;
|
||||
const int id = AV_RL32(buf + 12);
|
||||
const int whole_size = AV_RL32(buf + 16);
|
||||
CFrameBuffer *cfrm;
|
||||
|
||||
if (data_size < 0 || whole_size < 0) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "sizes invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (f->version <= 1) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "cfrm in version %d\n", f->version);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
id = AV_RL32(buf + 12);
|
||||
whole_size = AV_RL32(buf + 16);
|
||||
|
||||
if (data_size < 0 || whole_size < 0) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "sizes invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i = 0; i < CFRAME_BUFFER_COUNT; i++)
|
||||
if (f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
|
||||
av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n",
|
||||
@@ -857,6 +902,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n",
|
||||
id, avctx->frame_number);
|
||||
|
||||
if (f->version <= 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
cfrm->size = cfrm->id = 0;
|
||||
frame_4cc = AV_RL32("pfrm");
|
||||
} else
|
||||
@@ -895,16 +943,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
return -1;
|
||||
}
|
||||
} else if (frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")) {
|
||||
if (!f->last_picture.data[0]) {
|
||||
f->last_picture.reference = 3;
|
||||
if (ff_get_buffer(avctx, &f->last_picture) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
}
|
||||
for (i=0; i<avctx->height; i++)
|
||||
memset(f->last_picture.data[0] + i*f->last_picture.linesize[0], 0, 2*avctx->width);
|
||||
}
|
||||
|
||||
p->pict_type = AV_PICTURE_TYPE_P;
|
||||
if (decode_p_frame(f, buf, frame_size) < 0) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "decode p frame failed\n");
|
||||
|
@@ -64,7 +64,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
unsigned char *pixptr, *pixptr_end;
|
||||
unsigned int height = avctx->height; // Real image height
|
||||
unsigned int dlen, p, row;
|
||||
const unsigned char *lp, *dp;
|
||||
const unsigned char *lp, *dp, *ep;
|
||||
unsigned char count;
|
||||
unsigned int planes = c->planes;
|
||||
unsigned char *planemap = c->planemap;
|
||||
@@ -79,6 +79,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ep = encoded + buf_size;
|
||||
|
||||
/* Set data pointer after line lengths */
|
||||
dp = encoded + planes * (height << 1);
|
||||
|
||||
@@ -90,19 +92,19 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
for (row = 0; row < height; row++) {
|
||||
pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
|
||||
pixptr_end = pixptr + c->pic.linesize[0];
|
||||
if(lp - encoded + row*2 + 1 >= buf_size)
|
||||
return -1;
|
||||
if (ep - lp < row * 2 + 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2));
|
||||
/* Decode a row of this plane */
|
||||
while (dlen > 0) {
|
||||
if (dp + 1 >= buf + buf_size)
|
||||
if (ep - dp <= 1)
|
||||
return -1;
|
||||
if ((count = *dp++) <= 127) {
|
||||
count++;
|
||||
dlen -= count + 1;
|
||||
if (pixptr + count * planes > pixptr_end)
|
||||
break;
|
||||
if (dp + count > buf + buf_size)
|
||||
if (ep - dp < count)
|
||||
return -1;
|
||||
while (count--) {
|
||||
*pixptr = *dp++;
|
||||
|
@@ -25,7 +25,6 @@ OBJS = allcodecs.o \
|
||||
fmtconvert.o \
|
||||
imgconvert.o \
|
||||
jrevdct.o \
|
||||
log2_tab.o \
|
||||
mathtables.o \
|
||||
options.o \
|
||||
parser.o \
|
||||
@@ -39,6 +38,7 @@ OBJS = allcodecs.o \
|
||||
# parts needed for many different codecs
|
||||
OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o
|
||||
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
|
||||
OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o
|
||||
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
|
||||
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
|
||||
OBJS-$(CONFIG_DWT) += dwt.o snow.o
|
||||
@@ -68,6 +68,7 @@ OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \
|
||||
OBJS-$(CONFIG_RANGECODER) += rangecoder.o
|
||||
RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o
|
||||
OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
|
||||
OBJS-$(CONFIG_SHARED) += log2_tab.o
|
||||
OBJS-$(CONFIG_SINEWIN) += sinewin.o
|
||||
OBJS-$(CONFIG_VAAPI) += vaapi.o
|
||||
OBJS-$(CONFIG_VDPAU) += vdpau.o
|
||||
@@ -84,8 +85,7 @@ OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
|
||||
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \
|
||||
aacpsy.o aactab.o \
|
||||
psymodel.o iirfilter.o \
|
||||
mpeg4audio.o kbdwin.o \
|
||||
audio_frame_queue.o
|
||||
mpeg4audio.o kbdwin.o
|
||||
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
|
||||
@@ -317,8 +317,7 @@ OBJS-$(CONFIG_MVC1_DECODER) += mvcdec.o
|
||||
OBJS-$(CONFIG_MVC2_DECODER) += mvcdec.o
|
||||
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o \
|
||||
audio_frame_queue.o
|
||||
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o
|
||||
OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o
|
||||
OBJS-$(CONFIG_PAF_VIDEO_DECODER) += paf.o
|
||||
OBJS-$(CONFIG_PAF_AUDIO_DECODER) += paf.o
|
||||
@@ -358,8 +357,7 @@ OBJS-$(CONFIG_R10K_ENCODER) += r210enc.o
|
||||
OBJS-$(CONFIG_R210_DECODER) += r210dec.o
|
||||
OBJS-$(CONFIG_R210_ENCODER) += r210enc.o
|
||||
OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o
|
||||
OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o \
|
||||
audio_frame_queue.o
|
||||
OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o
|
||||
OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_filters.o
|
||||
OBJS-$(CONFIG_RALF_DECODER) += ralf.o
|
||||
OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o
|
||||
@@ -660,43 +658,39 @@ OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
|
||||
# external codec libraries
|
||||
OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o
|
||||
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
|
||||
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o audio_frame_queue.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o audio_frame_queue.o
|
||||
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o
|
||||
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
|
||||
OBJS-$(CONFIG_LIBGSM_DECODER) += libgsm.o
|
||||
OBJS-$(CONFIG_LIBGSM_ENCODER) += libgsm.o
|
||||
OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsm.o
|
||||
OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsm.o
|
||||
OBJS-$(CONFIG_LIBILBC_DECODER) += libilbc.o
|
||||
OBJS-$(CONFIG_LIBILBC_ENCODER) += libilbc.o
|
||||
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o \
|
||||
audio_frame_queue.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o \
|
||||
audio_frame_queue.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o \
|
||||
audio_frame_queue.o
|
||||
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
|
||||
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
|
||||
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
|
||||
OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_LIBOPUS_ENCODER) += libopusenc.o libopus.o \
|
||||
vorbis_data.o audio_frame_queue.o
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \
|
||||
libschroedinger.o
|
||||
OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \
|
||||
libschroedinger.o
|
||||
OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
|
||||
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o
|
||||
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
|
||||
OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o
|
||||
OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o
|
||||
OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o
|
||||
OBJS-$(CONFIG_LIBUTVIDEO_DECODER) += libutvideodec.o
|
||||
OBJS-$(CONFIG_LIBUTVIDEO_ENCODER) += libutvideoenc.o
|
||||
OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o \
|
||||
audio_frame_queue.o
|
||||
OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
|
||||
OBJS-$(CONFIG_LIBVORBIS_DECODER) += libvorbisdec.o
|
||||
OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o audio_frame_queue.o \
|
||||
OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \
|
||||
vorbis_data.o vorbis_parser.o xiph.o
|
||||
OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o
|
||||
OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o
|
||||
|
@@ -28,13 +28,13 @@
|
||||
#include "parser.h"
|
||||
|
||||
typedef enum {
|
||||
AAC_AC3_PARSE_ERROR_SYNC = -1,
|
||||
AAC_AC3_PARSE_ERROR_BSID = -2,
|
||||
AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -3,
|
||||
AAC_AC3_PARSE_ERROR_FRAME_SIZE = -4,
|
||||
AAC_AC3_PARSE_ERROR_FRAME_TYPE = -5,
|
||||
AAC_AC3_PARSE_ERROR_CRC = -6,
|
||||
AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -7,
|
||||
AAC_AC3_PARSE_ERROR_SYNC = -0x1030c0a,
|
||||
AAC_AC3_PARSE_ERROR_BSID = -0x2030c0a,
|
||||
AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -0x3030c0a,
|
||||
AAC_AC3_PARSE_ERROR_FRAME_SIZE = -0x4030c0a,
|
||||
AAC_AC3_PARSE_ERROR_FRAME_TYPE = -0x5030c0a,
|
||||
AAC_AC3_PARSE_ERROR_CRC = -0x6030c0a,
|
||||
AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -0x7030c0a,
|
||||
} AACAC3ParseError;
|
||||
|
||||
typedef struct AACAC3ParseContext {
|
||||
|
@@ -710,7 +710,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
|
||||
const float lambda)
|
||||
{
|
||||
int start = 0, i, w, w2, g;
|
||||
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
|
||||
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
|
||||
float dists[128] = { 0 }, uplims[128];
|
||||
float maxvals[128];
|
||||
int fflag, minscaler;
|
||||
|
@@ -113,6 +113,10 @@
|
||||
static VLC vlc_scalefactors;
|
||||
static VLC vlc_spectral[11];
|
||||
|
||||
static int output_configure(AACContext *ac,
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
|
||||
enum OCStatus oc_type, int get_new_frame);
|
||||
|
||||
#define overread_err "Input buffer exhausted before END element found\n"
|
||||
|
||||
static int count_channels(uint8_t (*layout)[3], int tags)
|
||||
@@ -143,6 +147,8 @@ static av_cold int che_configure(AACContext *ac,
|
||||
enum ChannelPosition che_pos,
|
||||
int type, int id, int *channels)
|
||||
{
|
||||
if (*channels >= MAX_CHANNELS)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (che_pos) {
|
||||
if (!ac->che[type][id]) {
|
||||
if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
|
||||
@@ -209,28 +215,39 @@ struct elem_to_channel {
|
||||
|
||||
static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
|
||||
uint8_t (*layout_map)[3], int offset, uint64_t left,
|
||||
uint64_t right, int pos)
|
||||
uint64_t right, int pos)
|
||||
{
|
||||
if (layout_map[offset][0] == TYPE_CPE) {
|
||||
e2c_vec[offset] = (struct elem_to_channel) {
|
||||
.av_position = left | right, .syn_ele = TYPE_CPE,
|
||||
.elem_id = layout_map[offset ][1], .aac_position = pos };
|
||||
.av_position = left | right,
|
||||
.syn_ele = TYPE_CPE,
|
||||
.elem_id = layout_map[offset][1],
|
||||
.aac_position = pos
|
||||
};
|
||||
return 1;
|
||||
} else {
|
||||
e2c_vec[offset] = (struct elem_to_channel) {
|
||||
.av_position = left, .syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[offset ][1], .aac_position = pos };
|
||||
e2c_vec[offset] = (struct elem_to_channel) {
|
||||
.av_position = left,
|
||||
.syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[offset][1],
|
||||
.aac_position = pos
|
||||
};
|
||||
e2c_vec[offset + 1] = (struct elem_to_channel) {
|
||||
.av_position = right, .syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[offset + 1][1], .aac_position = pos };
|
||||
.av_position = right,
|
||||
.syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[offset + 1][1],
|
||||
.aac_position = pos
|
||||
};
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, int *current) {
|
||||
static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos,
|
||||
int *current)
|
||||
{
|
||||
int num_pos_channels = 0;
|
||||
int first_cpe = 0;
|
||||
int sce_parity = 0;
|
||||
int first_cpe = 0;
|
||||
int sce_parity = 0;
|
||||
int i;
|
||||
for (i = *current; i < tags; i++) {
|
||||
if (layout_map[i][2] != pos)
|
||||
@@ -244,7 +261,7 @@ static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, in
|
||||
}
|
||||
}
|
||||
num_pos_channels += 2;
|
||||
first_cpe = 1;
|
||||
first_cpe = 1;
|
||||
} else {
|
||||
num_pos_channels++;
|
||||
sce_parity ^= 1;
|
||||
@@ -252,7 +269,7 @@ static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, in
|
||||
}
|
||||
if (sce_parity &&
|
||||
((pos == AAC_CHANNEL_FRONT && first_cpe) || pos == AAC_CHANNEL_SIDE))
|
||||
return -1;
|
||||
return -1;
|
||||
*current = i;
|
||||
return num_pos_channels;
|
||||
}
|
||||
@@ -260,7 +277,7 @@ static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, in
|
||||
static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
{
|
||||
int i, n, total_non_cc_elements;
|
||||
struct elem_to_channel e2c_vec[4*MAX_ELEM_ID] = {{ 0 }};
|
||||
struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { { 0 } };
|
||||
int num_front_channels, num_side_channels, num_back_channels;
|
||||
uint64_t layout;
|
||||
|
||||
@@ -284,8 +301,11 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
i = 0;
|
||||
if (num_front_channels & 1) {
|
||||
e2c_vec[i] = (struct elem_to_channel) {
|
||||
.av_position = AV_CH_FRONT_CENTER, .syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_FRONT };
|
||||
.av_position = AV_CH_FRONT_CENTER,
|
||||
.syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[i][1],
|
||||
.aac_position = AAC_CHANNEL_FRONT
|
||||
};
|
||||
i++;
|
||||
num_front_channels--;
|
||||
}
|
||||
@@ -342,22 +362,31 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
}
|
||||
if (num_back_channels) {
|
||||
e2c_vec[i] = (struct elem_to_channel) {
|
||||
.av_position = AV_CH_BACK_CENTER, .syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_BACK };
|
||||
.av_position = AV_CH_BACK_CENTER,
|
||||
.syn_ele = TYPE_SCE,
|
||||
.elem_id = layout_map[i][1],
|
||||
.aac_position = AAC_CHANNEL_BACK
|
||||
};
|
||||
i++;
|
||||
num_back_channels--;
|
||||
}
|
||||
|
||||
if (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) {
|
||||
e2c_vec[i] = (struct elem_to_channel) {
|
||||
.av_position = AV_CH_LOW_FREQUENCY, .syn_ele = TYPE_LFE,
|
||||
.elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE };
|
||||
.av_position = AV_CH_LOW_FREQUENCY,
|
||||
.syn_ele = TYPE_LFE,
|
||||
.elem_id = layout_map[i][1],
|
||||
.aac_position = AAC_CHANNEL_LFE
|
||||
};
|
||||
i++;
|
||||
}
|
||||
while (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) {
|
||||
e2c_vec[i] = (struct elem_to_channel) {
|
||||
.av_position = UINT64_MAX, .syn_ele = TYPE_LFE,
|
||||
.elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE };
|
||||
.av_position = UINT64_MAX,
|
||||
.syn_ele = TYPE_LFE,
|
||||
.elem_id = layout_map[i][1],
|
||||
.aac_position = AAC_CHANNEL_LFE
|
||||
};
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -365,12 +394,11 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
|
||||
total_non_cc_elements = n = i;
|
||||
do {
|
||||
int next_n = 0;
|
||||
for (i = 1; i < n; i++) {
|
||||
if (e2c_vec[i-1].av_position > e2c_vec[i].av_position) {
|
||||
FFSWAP(struct elem_to_channel, e2c_vec[i-1], e2c_vec[i]);
|
||||
for (i = 1; i < n; i++)
|
||||
if (e2c_vec[i - 1].av_position > e2c_vec[i].av_position) {
|
||||
FFSWAP(struct elem_to_channel, e2c_vec[i - 1], e2c_vec[i]);
|
||||
next_n = i;
|
||||
}
|
||||
}
|
||||
n = next_n;
|
||||
} while (n > 0);
|
||||
|
||||
@@ -406,16 +434,19 @@ static void pop_output_configuration(AACContext *ac) {
|
||||
ac->oc[1] = ac->oc[0];
|
||||
ac->avctx->channels = ac->oc[1].channels;
|
||||
ac->avctx->channel_layout = ac->oc[1].channel_layout;
|
||||
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
|
||||
ac->oc[1].status, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure output channel order based on the current program configuration element.
|
||||
* Configure output channel order based on the current program
|
||||
* configuration element.
|
||||
*
|
||||
* @return Returns error status. 0 - OK, !0 - error
|
||||
*/
|
||||
static int output_configure(AACContext *ac,
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
|
||||
uint8_t layout_map[MAX_ELEM_ID * 4][3], int tags,
|
||||
enum OCStatus oc_type, int get_new_frame)
|
||||
{
|
||||
AVCodecContext *avctx = ac->avctx;
|
||||
@@ -487,36 +518,40 @@ static void flush(AVCodecContext *avctx)
|
||||
* @return Returns error status. 0 - OK, !0 - error
|
||||
*/
|
||||
static int set_default_channel_config(AVCodecContext *avctx,
|
||||
uint8_t (*layout_map)[3],
|
||||
int *tags,
|
||||
int channel_config)
|
||||
uint8_t (*layout_map)[3],
|
||||
int *tags,
|
||||
int channel_config)
|
||||
{
|
||||
if (channel_config < 1 || channel_config > 7) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"invalid default channel configuration (%d)\n",
|
||||
channel_config);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
*tags = tags_per_config[channel_config];
|
||||
memcpy(layout_map, aac_channel_layout_map[channel_config-1], *tags * sizeof(*layout_map));
|
||||
memcpy(layout_map, aac_channel_layout_map[channel_config - 1],
|
||||
*tags * sizeof(*layout_map));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
{
|
||||
// For PCE based channel configurations map the channels solely based on tags.
|
||||
/* For PCE based channel configurations map the channels solely based
|
||||
* on tags. */
|
||||
if (!ac->oc[1].m4ac.chan_config) {
|
||||
return ac->tag_che_map[type][elem_id];
|
||||
}
|
||||
// Allow single CPE stereo files to be signalled with mono configuration.
|
||||
if (!ac->tags_mapped && type == TYPE_CPE && ac->oc[1].m4ac.chan_config == 1) {
|
||||
if (!ac->tags_mapped && type == TYPE_CPE &&
|
||||
ac->oc[1].m4ac.chan_config == 1) {
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3];
|
||||
int layout_map_tags;
|
||||
push_output_configuration(ac);
|
||||
|
||||
av_log(ac->avctx, AV_LOG_DEBUG, "mono with CPE\n");
|
||||
|
||||
if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
|
||||
2) < 0)
|
||||
if (set_default_channel_config(ac->avctx, layout_map,
|
||||
&layout_map_tags, 2) < 0)
|
||||
return NULL;
|
||||
if (output_configure(ac, layout_map, layout_map_tags,
|
||||
OC_TRIAL_FRAME, 1) < 0)
|
||||
@@ -526,15 +561,16 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
ac->oc[1].m4ac.ps = 0;
|
||||
}
|
||||
// And vice-versa
|
||||
if (!ac->tags_mapped && type == TYPE_SCE && ac->oc[1].m4ac.chan_config == 2) {
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3];
|
||||
if (!ac->tags_mapped && type == TYPE_SCE &&
|
||||
ac->oc[1].m4ac.chan_config == 2) {
|
||||
uint8_t layout_map[MAX_ELEM_ID * 4][3];
|
||||
int layout_map_tags;
|
||||
push_output_configuration(ac);
|
||||
|
||||
av_log(ac->avctx, AV_LOG_DEBUG, "stereo with SCE\n");
|
||||
|
||||
if (set_default_channel_config(ac->avctx, layout_map, &layout_map_tags,
|
||||
1) < 0)
|
||||
if (set_default_channel_config(ac->avctx, layout_map,
|
||||
&layout_map_tags, 1) < 0)
|
||||
return NULL;
|
||||
if (output_configure(ac, layout_map, layout_map_tags,
|
||||
OC_TRIAL_FRAME, 1) < 0)
|
||||
@@ -544,7 +580,8 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
if (ac->oc[1].m4ac.sbr)
|
||||
ac->oc[1].m4ac.ps = -1;
|
||||
}
|
||||
// For indexed channel configurations map the channels solely based on position.
|
||||
/* For indexed channel configurations map the channels solely based
|
||||
* on position. */
|
||||
switch (ac->oc[1].m4ac.chan_config) {
|
||||
case 7:
|
||||
if (ac->tags_mapped == 3 && type == TYPE_CPE) {
|
||||
@@ -552,9 +589,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
|
||||
}
|
||||
case 6:
|
||||
/* Some streams incorrectly code 5.1 audio as SCE[0] CPE[0] CPE[1] SCE[1]
|
||||
instead of SCE[0] CPE[0] CPE[1] LFE[0]. If we seem to have
|
||||
encountered such a stream, transfer the LFE[0] element to the SCE[1]'s mapping */
|
||||
/* Some streams incorrectly code 5.1 audio as
|
||||
* SCE[0] CPE[0] CPE[1] SCE[1]
|
||||
* instead of
|
||||
* SCE[0] CPE[0] CPE[1] LFE[0].
|
||||
* If we seem to have encountered such a stream, transfer
|
||||
* the LFE[0] element to the SCE[1]'s mapping */
|
||||
if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
|
||||
ac->tags_mapped++;
|
||||
return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0];
|
||||
@@ -565,13 +605,16 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1];
|
||||
}
|
||||
case 4:
|
||||
if (ac->tags_mapped == 2 && ac->oc[1].m4ac.chan_config == 4 && type == TYPE_SCE) {
|
||||
if (ac->tags_mapped == 2 &&
|
||||
ac->oc[1].m4ac.chan_config == 4 &&
|
||||
type == TYPE_SCE) {
|
||||
ac->tags_mapped++;
|
||||
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
|
||||
}
|
||||
case 3:
|
||||
case 2:
|
||||
if (ac->tags_mapped == (ac->oc[1].m4ac.chan_config != 2) && type == TYPE_CPE) {
|
||||
if (ac->tags_mapped == (ac->oc[1].m4ac.chan_config != 2) &&
|
||||
type == TYPE_CPE) {
|
||||
ac->tags_mapped++;
|
||||
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
|
||||
} else if (ac->oc[1].m4ac.chan_config == 2) {
|
||||
@@ -588,7 +631,8 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit.
|
||||
* Decode an array of 4 bit element IDs, optionally interleaved with a
|
||||
* stereo/mono switching bit.
|
||||
*
|
||||
* @param type speaker type/position for these channels
|
||||
*/
|
||||
@@ -630,7 +674,8 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
|
||||
uint8_t (*layout_map)[3],
|
||||
GetBitContext *gb)
|
||||
{
|
||||
int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc, sampling_index;
|
||||
int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc;
|
||||
int sampling_index;
|
||||
int comment_len;
|
||||
int tags;
|
||||
|
||||
@@ -638,7 +683,9 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
|
||||
|
||||
sampling_index = get_bits(gb, 4);
|
||||
if (m4ac->sampling_index != sampling_index)
|
||||
av_log(avctx, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n");
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"Sample rate index in program config element does not "
|
||||
"match the sample rate index configured by the container.\n");
|
||||
|
||||
num_front = get_bits(gb, 4);
|
||||
num_side = get_bits(gb, 4);
|
||||
@@ -679,7 +726,7 @@ static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
|
||||
comment_len = get_bits(gb, 8) * 8;
|
||||
if (get_bits_left(gb) < comment_len) {
|
||||
av_log(avctx, AV_LOG_ERROR, "decode_pce: " overread_err);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
skip_bits_long(gb, comment_len);
|
||||
return tags;
|
||||
@@ -721,7 +768,8 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
|
||||
if (tags < 0)
|
||||
return tags;
|
||||
} else {
|
||||
if ((ret = set_default_channel_config(avctx, layout_map, &tags, channel_config)))
|
||||
if ((ret = set_default_channel_config(avctx, layout_map,
|
||||
&tags, channel_config)))
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -743,7 +791,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
|
||||
case AOT_ER_AAC_LTP:
|
||||
case AOT_ER_AAC_SCALABLE:
|
||||
case AOT_ER_AAC_LD:
|
||||
skip_bits(gb, 3); /* aacSectionDataResilienceFlag
|
||||
skip_bits(gb, 3); /* aacSectionDataResilienceFlag
|
||||
* aacScalefactorDataResilienceFlag
|
||||
* aacSpectralDataResilienceFlag
|
||||
*/
|
||||
@@ -773,20 +821,24 @@ static int decode_audio_specific_config(AACContext *ac,
|
||||
int sync_extension)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int i;
|
||||
int i, ret;
|
||||
|
||||
av_dlog(avctx, "audio specific config size %d\n", bit_size >> 3);
|
||||
for (i = 0; i < bit_size >> 3; i++)
|
||||
av_dlog(avctx, "%02x ", data[i]);
|
||||
av_dlog(avctx, "\n");
|
||||
|
||||
init_get_bits(&gb, data, bit_size);
|
||||
if ((ret = init_get_bits(&gb, data, bit_size)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((i = avpriv_mpeg4audio_get_config(m4ac, data, bit_size, sync_extension)) < 0)
|
||||
return -1;
|
||||
if ((i = avpriv_mpeg4audio_get_config(m4ac, data, bit_size,
|
||||
sync_extension)) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (m4ac->sampling_index > 12) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index);
|
||||
return -1;
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"invalid sampling rate index %d\n",
|
||||
m4ac->sampling_index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
skip_bits_long(&gb, i);
|
||||
@@ -795,18 +847,23 @@ static int decode_audio_specific_config(AACContext *ac,
|
||||
case AOT_AAC_MAIN:
|
||||
case AOT_AAC_LC:
|
||||
case AOT_AAC_LTP:
|
||||
if (decode_ga_specific_config(ac, avctx, &gb, m4ac, m4ac->chan_config))
|
||||
return -1;
|
||||
if ((ret = decode_ga_specific_config(ac, avctx, &gb,
|
||||
m4ac, m4ac->chan_config)) < 0)
|
||||
return ret;
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n",
|
||||
m4ac->sbr == 1? "SBR+" : "", m4ac->object_type);
|
||||
return -1;
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Audio object type %s%d is not supported.\n",
|
||||
m4ac->sbr == 1 ? "SBR+" : "",
|
||||
m4ac->object_type);
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
av_dlog(avctx, "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
|
||||
av_dlog(avctx,
|
||||
"AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
|
||||
m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
|
||||
m4ac->sample_rate, m4ac->sbr, m4ac->ps);
|
||||
m4ac->sample_rate, m4ac->sbr,
|
||||
m4ac->ps);
|
||||
|
||||
return get_bits_count(&gb);
|
||||
}
|
||||
@@ -864,15 +921,18 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
|
||||
reset_predict_state(&ps[i]);
|
||||
}
|
||||
|
||||
#define AAC_INIT_VLC_STATIC(num, size) \
|
||||
INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
|
||||
ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
|
||||
ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
|
||||
#define AAC_INIT_VLC_STATIC(num, size) \
|
||||
INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
|
||||
ff_aac_spectral_bits[num], sizeof(ff_aac_spectral_bits[num][0]), \
|
||||
sizeof(ff_aac_spectral_bits[num][0]), \
|
||||
ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), \
|
||||
sizeof(ff_aac_spectral_codes[num][0]), \
|
||||
size);
|
||||
|
||||
static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
AACContext *ac = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
ac->avctx = avctx;
|
||||
ac->oc[1].m4ac.sample_rate = avctx->sample_rate;
|
||||
@@ -880,10 +940,11 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||
|
||||
if (avctx->extradata_size > 0) {
|
||||
if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
|
||||
avctx->extradata,
|
||||
avctx->extradata_size*8, 1) < 0)
|
||||
return -1;
|
||||
if ((ret = decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
|
||||
avctx->extradata,
|
||||
avctx->extradata_size * 8,
|
||||
1)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
int sr, i;
|
||||
uint8_t layout_map[MAX_ELEM_ID*4][3];
|
||||
@@ -941,9 +1002,14 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
|
||||
ff_aac_tableinit();
|
||||
|
||||
INIT_VLC_STATIC(&vlc_scalefactors,7,FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
|
||||
ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]),
|
||||
ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]),
|
||||
INIT_VLC_STATIC(&vlc_scalefactors, 7,
|
||||
FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
|
||||
ff_aac_scalefactor_bits,
|
||||
sizeof(ff_aac_scalefactor_bits[0]),
|
||||
sizeof(ff_aac_scalefactor_bits[0]),
|
||||
ff_aac_scalefactor_code,
|
||||
sizeof(ff_aac_scalefactor_code[0]),
|
||||
sizeof(ff_aac_scalefactor_code[0]),
|
||||
352);
|
||||
|
||||
ff_mdct_init(&ac->mdct, 11, 1, 1.0 / (32768.0 * 1024.0));
|
||||
@@ -977,7 +1043,7 @@ static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
|
||||
|
||||
if (get_bits_left(gb) < 8 * count) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "skip_data_stream_element: "overread_err);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
skip_bits_long(gb, 8 * count);
|
||||
return 0;
|
||||
@@ -989,9 +1055,11 @@ static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
|
||||
int sfb;
|
||||
if (get_bits1(gb)) {
|
||||
ics->predictor_reset_group = get_bits(gb, 5);
|
||||
if (ics->predictor_reset_group == 0 || ics->predictor_reset_group > 30) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Invalid Predictor Reset Group.\n");
|
||||
return -1;
|
||||
if (ics->predictor_reset_group == 0 ||
|
||||
ics->predictor_reset_group > 30) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Invalid Predictor Reset Group.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
for (sfb = 0; sfb < FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index]); sfb++) {
|
||||
@@ -1060,7 +1128,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||
goto fail;
|
||||
}
|
||||
} else if (ac->oc[1].m4ac.object_type == AOT_AAC_LC) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n");
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Prediction is not allowed in AAC-LC.\n");
|
||||
goto fail;
|
||||
} else {
|
||||
if ((ics->ltp.present = get_bits(gb, 1)))
|
||||
@@ -1071,7 +1140,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
|
||||
|
||||
if (ics->max_sfb > ics->num_swb) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Number of scalefactor bands in group (%d) exceeds limit (%d).\n",
|
||||
"Number of scalefactor bands in group (%d) "
|
||||
"exceeds limit (%d).\n",
|
||||
ics->max_sfb, ics->num_swb);
|
||||
goto fail;
|
||||
}
|
||||
@@ -1104,20 +1174,20 @@ static int decode_band_types(AACContext *ac, enum BandType band_type[120],
|
||||
int sect_band_type = get_bits(gb, 4);
|
||||
if (sect_band_type == 12) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
do {
|
||||
sect_len_incr = get_bits(gb, bits);
|
||||
sect_end += sect_len_incr;
|
||||
if (get_bits_left(gb) < 0) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "decode_band_types: "overread_err);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (sect_end > ics->max_sfb) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Number of bands (%d) exceeds limit (%d).\n",
|
||||
sect_end, ics->max_sfb);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} while (sect_len_incr == (1 << bits) - 1);
|
||||
for (; k < sect_end; k++) {
|
||||
@@ -1155,7 +1225,8 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
||||
if (band_type[idx] == ZERO_BT) {
|
||||
for (; i < run_end; i++, idx++)
|
||||
sf[idx] = 0.;
|
||||
} else if ((band_type[idx] == INTENSITY_BT) || (band_type[idx] == INTENSITY_BT2)) {
|
||||
} else if ((band_type[idx] == INTENSITY_BT) ||
|
||||
(band_type[idx] == INTENSITY_BT2)) {
|
||||
for (; i < run_end; i++, idx++) {
|
||||
offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
||||
clipped_offset = av_clip(offset[2], -155, 100);
|
||||
@@ -1188,7 +1259,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
||||
if (offset[0] > 255U) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Scalefactor (%d) out of range.\n", offset[0]);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO];
|
||||
}
|
||||
@@ -1243,10 +1314,11 @@ static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
|
||||
tns->length[w][filt] = get_bits(gb, 6 - 2 * is8);
|
||||
|
||||
if ((tns->order[w][filt] = get_bits(gb, 5 - 2 * is8)) > tns_max_order) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "TNS filter order %d is greater than maximum %d.\n",
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"TNS filter order %d is greater than maximum %d.\n",
|
||||
tns->order[w][filt], tns_max_order);
|
||||
tns->order[w][filt] = 0;
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (tns->order[w][filt]) {
|
||||
tns->direction[w][filt] = get_bits1(gb);
|
||||
@@ -1275,7 +1347,9 @@ static void decode_mid_side_stereo(ChannelElement *cpe, GetBitContext *gb,
|
||||
{
|
||||
int idx;
|
||||
if (ms_present == 1) {
|
||||
for (idx = 0; idx < cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb; idx++)
|
||||
for (idx = 0;
|
||||
idx < cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb;
|
||||
idx++)
|
||||
cpe->ms_mask[idx] = get_bits1(gb);
|
||||
} else if (ms_present == 2) {
|
||||
memset(cpe->ms_mask, 1, sizeof(cpe->ms_mask[0]) * cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb);
|
||||
@@ -1374,7 +1448,8 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
|
||||
float *coef_base = coef;
|
||||
|
||||
for (g = 0; g < ics->num_windows; g++)
|
||||
memset(coef + g * 128 + offsets[ics->max_sfb], 0, sizeof(float) * (c - offsets[ics->max_sfb]));
|
||||
memset(coef + g * 128 + offsets[ics->max_sfb], 0,
|
||||
sizeof(float) * (c - offsets[ics->max_sfb]));
|
||||
|
||||
for (g = 0; g < ics->num_window_groups; g++) {
|
||||
unsigned g_len = ics->group_len[g];
|
||||
@@ -1529,7 +1604,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
|
||||
|
||||
if (b > 8) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
SKIP_BITS(re, gb, b + 1);
|
||||
@@ -1644,14 +1719,20 @@ static void apply_prediction(AACContext *ac, SingleChannelElement *sce)
|
||||
}
|
||||
|
||||
if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
|
||||
for (sfb = 0; sfb < ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index]; sfb++) {
|
||||
for (k = sce->ics.swb_offset[sfb]; k < sce->ics.swb_offset[sfb + 1]; k++) {
|
||||
for (sfb = 0;
|
||||
sfb < ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index];
|
||||
sfb++) {
|
||||
for (k = sce->ics.swb_offset[sfb];
|
||||
k < sce->ics.swb_offset[sfb + 1];
|
||||
k++) {
|
||||
predict(&sce->predictor_state[k], &sce->coeffs[k],
|
||||
sce->ics.predictor_present && sce->ics.prediction_used[sfb]);
|
||||
sce->ics.predictor_present &&
|
||||
sce->ics.prediction_used[sfb]);
|
||||
}
|
||||
}
|
||||
if (sce->ics.predictor_reset_group)
|
||||
reset_predictor_group(sce->predictor_state, sce->ics.predictor_reset_group);
|
||||
reset_predictor_group(sce->predictor_state,
|
||||
sce->ics.predictor_reset_group);
|
||||
} else
|
||||
reset_all_predictors(sce->predictor_state);
|
||||
}
|
||||
@@ -1672,6 +1753,7 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
||||
IndividualChannelStream *ics = &sce->ics;
|
||||
float *out = sce->coeffs;
|
||||
int global_gain, pulse_present = 0;
|
||||
int ret;
|
||||
|
||||
/* This assignment is to silence a GCC warning about the variable being used
|
||||
* uninitialized when in fact it always is.
|
||||
@@ -1685,33 +1767,38 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (decode_band_types(ac, sce->band_type, sce->band_type_run_end, gb, ics) < 0)
|
||||
return -1;
|
||||
if (decode_scalefactors(ac, sce->sf, gb, global_gain, ics, sce->band_type, sce->band_type_run_end) < 0)
|
||||
return -1;
|
||||
if ((ret = decode_band_types(ac, sce->band_type,
|
||||
sce->band_type_run_end, gb, ics)) < 0)
|
||||
return ret;
|
||||
if ((ret = decode_scalefactors(ac, sce->sf, gb, global_gain, ics,
|
||||
sce->band_type, sce->band_type_run_end)) < 0)
|
||||
return ret;
|
||||
|
||||
pulse_present = 0;
|
||||
if (!scale_flag) {
|
||||
if ((pulse_present = get_bits1(gb))) {
|
||||
if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");
|
||||
return -1;
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Pulse tool not allowed in eight short sequence.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "Pulse data corrupt or invalid.\n");
|
||||
return -1;
|
||||
av_log(ac->avctx, AV_LOG_ERROR,
|
||||
"Pulse data corrupt or invalid.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (get_bits1(gb)) {
|
||||
av_log_missing_feature(ac->avctx, "SSR", 1);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
}
|
||||
|
||||
if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present, &pulse, ics, sce->band_type) < 0)
|
||||
return -1;
|
||||
if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present,
|
||||
&pulse, ics, sce->band_type) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN && !common_window)
|
||||
apply_prediction(ac, sce);
|
||||
@@ -1732,7 +1819,8 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
|
||||
for (g = 0; g < ics->num_window_groups; g++) {
|
||||
for (i = 0; i < ics->max_sfb; i++, idx++) {
|
||||
if (cpe->ms_mask[idx] &&
|
||||
cpe->ch[0].band_type[idx] < NOISE_BT && cpe->ch[1].band_type[idx] < NOISE_BT) {
|
||||
cpe->ch[0].band_type[idx] < NOISE_BT &&
|
||||
cpe->ch[1].band_type[idx] < NOISE_BT) {
|
||||
for (group = 0; group < ics->group_len[g]; group++) {
|
||||
ac->dsp.butterflies_float(ch0 + group * 128 + offsets[i],
|
||||
ch1 + group * 128 + offsets[i],
|
||||
@@ -1752,7 +1840,8 @@ static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
|
||||
* [1] mask is decoded from bitstream; [2] mask is all 1s;
|
||||
* [3] reserved for scalable AAC
|
||||
*/
|
||||
static void apply_intensity_stereo(AACContext *ac, ChannelElement *cpe, int ms_present)
|
||||
static void apply_intensity_stereo(AACContext *ac,
|
||||
ChannelElement *cpe, int ms_present)
|
||||
{
|
||||
const IndividualChannelStream *ics = &cpe->ch[1].ics;
|
||||
SingleChannelElement *sce1 = &cpe->ch[1];
|
||||
@@ -1763,7 +1852,8 @@ static void apply_intensity_stereo(AACContext *ac, ChannelElement *cpe, int ms_p
|
||||
float scale;
|
||||
for (g = 0; g < ics->num_window_groups; g++) {
|
||||
for (i = 0; i < ics->max_sfb;) {
|
||||
if (sce1->band_type[idx] == INTENSITY_BT || sce1->band_type[idx] == INTENSITY_BT2) {
|
||||
if (sce1->band_type[idx] == INTENSITY_BT ||
|
||||
sce1->band_type[idx] == INTENSITY_BT2) {
|
||||
const int bt_run_end = sce1->band_type_run_end[idx];
|
||||
for (; i < bt_run_end; i++, idx++) {
|
||||
c = -1 + 2 * (sce1->band_type[idx] - 14);
|
||||
@@ -1803,13 +1893,14 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
|
||||
i = cpe->ch[1].ics.use_kb_window[0];
|
||||
cpe->ch[1].ics = cpe->ch[0].ics;
|
||||
cpe->ch[1].ics.use_kb_window[1] = i;
|
||||
if (cpe->ch[1].ics.predictor_present && (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN))
|
||||
if (cpe->ch[1].ics.predictor_present &&
|
||||
(ac->oc[1].m4ac.object_type != AOT_AAC_MAIN))
|
||||
if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1)))
|
||||
decode_ltp(&cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb);
|
||||
ms_present = get_bits(gb, 2);
|
||||
if (ms_present == 3) {
|
||||
av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (ms_present)
|
||||
decode_mid_side_stereo(cpe, gb, ms_present);
|
||||
}
|
||||
@@ -2670,7 +2761,8 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (ac->force_dmono_mode >= 0)
|
||||
ac->dmono_mode = ac->force_dmono_mode;
|
||||
|
||||
init_get_bits(&gb, buf, buf_size * 8);
|
||||
if ((err = init_get_bits(&gb, buf, buf_size * 8)) < 0)
|
||||
return err;
|
||||
|
||||
if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt)) < 0)
|
||||
return err;
|
||||
@@ -2706,13 +2798,13 @@ static av_cold int aac_decode_close(AVCodecContext *avctx)
|
||||
#define LOAS_SYNC_WORD 0x2b7 ///< 11 bits LOAS sync word
|
||||
|
||||
struct LATMContext {
|
||||
AACContext aac_ctx; ///< containing AACContext
|
||||
int initialized; ///< initialized after a valid extradata was seen
|
||||
AACContext aac_ctx; ///< containing AACContext
|
||||
int initialized; ///< initilized after a valid extradata was seen
|
||||
|
||||
// parser data
|
||||
int audio_mux_version_A; ///< LATM syntax version
|
||||
int frame_length_type; ///< 0/1 variable/fixed frame length
|
||||
int frame_length; ///< frame length for fixed frame length
|
||||
int audio_mux_version_A; ///< LATM syntax version
|
||||
int frame_length_type; ///< 0/1 variable/fixed frame length
|
||||
int frame_length; ///< frame length for fixed frame length
|
||||
};
|
||||
|
||||
static inline uint32_t latm_get_value(GetBitContext *b)
|
||||
@@ -2920,7 +3012,8 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out,
|
||||
int muxlength, err;
|
||||
GetBitContext gb;
|
||||
|
||||
init_get_bits(&gb, avpkt->data, avpkt->size * 8);
|
||||
if ((err = init_get_bits(&gb, avpkt->data, avpkt->size * 8)) < 0)
|
||||
return err;
|
||||
|
||||
// check for LOAS sync word
|
||||
if (get_bits(&gb, 11) != LOAS_SYNC_WORD)
|
||||
|
@@ -1121,7 +1121,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
|
||||
for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) {
|
||||
float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f);
|
||||
float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha);
|
||||
float fac = temp1 / (1.0f + temp2);
|
||||
float fac;
|
||||
if (temp1 > 1E20) {
|
||||
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
|
||||
temp1 = 1;
|
||||
}
|
||||
fac = temp1 / (1.0f + temp2);
|
||||
sbr->data[0].env_facs[e][k] = fac;
|
||||
sbr->data[1].env_facs[e][k] = fac * temp2;
|
||||
}
|
||||
@@ -1130,7 +1135,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
|
||||
for (k = 0; k < sbr->n_q; k++) {
|
||||
float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1);
|
||||
float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]);
|
||||
float fac = temp1 / (1.0f + temp2);
|
||||
float fac;
|
||||
if (temp1 > 1E20) {
|
||||
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
|
||||
temp1 = 1;
|
||||
}
|
||||
fac = temp1 / (1.0f + temp2);
|
||||
sbr->data[0].noise_facs[e][k] = fac;
|
||||
sbr->data[1].noise_facs[e][k] = fac * temp2;
|
||||
}
|
||||
@@ -1139,9 +1149,15 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
|
||||
for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) {
|
||||
float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f;
|
||||
for (e = 1; e <= sbr->data[ch].bs_num_env; e++)
|
||||
for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++)
|
||||
for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){
|
||||
sbr->data[ch].env_facs[e][k] =
|
||||
exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f);
|
||||
if (sbr->data[ch].env_facs[e][k] > 1E20) {
|
||||
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
|
||||
sbr->data[ch].env_facs[e][k] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)
|
||||
for (k = 0; k < sbr->n_q; k++)
|
||||
sbr->data[ch].noise_facs[e][k] =
|
||||
|
@@ -292,7 +292,7 @@ static int parse_frame_header(AC3DecodeContext *s)
|
||||
return ff_eac3_parse_header(s);
|
||||
} else {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n");
|
||||
return -1;
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -787,12 +787,12 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
if (start_subband >= end_subband) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
|
||||
"range (%d >= %d)\n", start_subband, end_subband);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (dst_start_freq >= src_start_freq) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
|
||||
"copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->spx_dst_start_freq = dst_start_freq;
|
||||
@@ -869,7 +869,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
|
||||
if (channel_mode < AC3_CHMODE_STEREO) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "coupling not allowed in mono or dual-mono\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* check for enhanced coupling */
|
||||
@@ -899,7 +899,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
if (cpl_start_subband >= cpl_end_subband) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n",
|
||||
cpl_start_subband, cpl_end_subband);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37;
|
||||
s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37;
|
||||
@@ -921,7 +921,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
if (!blk) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must "
|
||||
"be present in block 0\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else {
|
||||
s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
|
||||
}
|
||||
@@ -951,7 +951,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
} else if (!blk) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must "
|
||||
"be present in block 0\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else {
|
||||
/* channel not in coupling */
|
||||
@@ -1006,7 +1006,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
int bandwidth_code = get_bits(gbc, 6);
|
||||
if (bandwidth_code > 60) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "bandwidth code = %d > 60\n", bandwidth_code);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->end_freq[ch] = bandwidth_code * 3 + 73;
|
||||
}
|
||||
@@ -1029,7 +1029,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
s->num_exp_groups[ch], s->dexps[ch][0],
|
||||
&s->dexps[ch][s->start_freq[ch]+!!ch])) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "exponent out-of-range\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (ch != CPL_CH && ch != s->lfe_ch)
|
||||
skip_bits(gbc, 2); /* skip gainrng */
|
||||
@@ -1049,7 +1049,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
} else if (!blk) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must "
|
||||
"be present in block 0\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1080,7 +1080,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
}
|
||||
} else if (!s->eac3 && !blk) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1119,7 +1119,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
} else if (!s->eac3 && !blk) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must "
|
||||
"be present in block 0\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
s->first_cpl_leak = 0;
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
s->dba_mode[ch] = get_bits(gbc, 2);
|
||||
if (s->dba_mode[ch] == DBA_RESERVED) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
|
||||
}
|
||||
@@ -1172,7 +1172,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
|
||||
s->dba_offsets[ch], s->dba_lengths[ch],
|
||||
s->dba_values[ch], s->mask[ch])) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (bit_alloc_stages[ch] > 0) {
|
||||
@@ -1291,7 +1291,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||
switch (err) {
|
||||
case AAC_AC3_PARSE_ERROR_SYNC:
|
||||
av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
case AAC_AC3_PARSE_ERROR_BSID:
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
|
||||
break;
|
||||
@@ -1305,17 +1305,20 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||
/* skip frame if CRC is ok. otherwise use error concealment. */
|
||||
/* TODO: add support for substreams and dependent frames */
|
||||
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {
|
||||
av_log(avctx, AV_LOG_ERROR, "unsupported frame type : "
|
||||
av_log(avctx, AV_LOG_WARNING, "unsupported frame type : "
|
||||
"skipping frame\n");
|
||||
*got_frame_ptr = 0;
|
||||
return s->frame_size;
|
||||
return buf_size;
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid header\n");
|
||||
case AAC_AC3_PARSE_ERROR_CRC:
|
||||
case AAC_AC3_PARSE_ERROR_CHANNEL_CFG:
|
||||
break;
|
||||
default: // Normal AVERROR do not try to recover.
|
||||
*got_frame_ptr = 0;
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
/* check that reported frame size fits in input buffer */
|
||||
@@ -1336,8 +1339,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||
if (!err) {
|
||||
avctx->sample_rate = s->sample_rate;
|
||||
avctx->bit_rate = s->bit_rate;
|
||||
}
|
||||
|
||||
/* channel config */
|
||||
/* channel config */
|
||||
if (!err || (s->channels && s->out_channels != s->channels)) {
|
||||
s->out_channels = s->channels;
|
||||
s->output_mode = s->channel_mode;
|
||||
if (s->lfe_on)
|
||||
@@ -1360,22 +1365,18 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
|
||||
s->fbw_channels == s->out_channels)) {
|
||||
set_downmix_coeffs(s);
|
||||
}
|
||||
} else if (!s->out_channels) {
|
||||
s->out_channels = avctx->channels;
|
||||
if (s->out_channels < s->channels)
|
||||
s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
|
||||
}
|
||||
if (avctx->channels != s->out_channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "channel number mismatching on damaged frame\n");
|
||||
} else if (!s->channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->channels = s->out_channels;
|
||||
|
||||
/* set audio service type based on bitstream mode for AC-3 */
|
||||
avctx->audio_service_type = s->bitstream_mode;
|
||||
if (s->bitstream_mode == 0x7 && s->channels > 1)
|
||||
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
|
||||
|
||||
/* get output buffer */
|
||||
avctx->channels = s->out_channels;
|
||||
s->frame.nb_samples = s->num_blocks * 256;
|
||||
if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
|
@@ -321,6 +321,9 @@ static int decode_element(AVCodecContext *avctx, void *data, int ch_index,
|
||||
rice_history_mult[ch] = get_bits(&alac->gb, 3);
|
||||
lpc_order[ch] = get_bits(&alac->gb, 5);
|
||||
|
||||
if (lpc_order[ch] >= alac->max_samples_per_frame)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* read the predictor table */
|
||||
for (i = lpc_order[ch] - 1; i >= 0; i--)
|
||||
lpc_coefs[ch][i] = get_sbits(&alac->gb, 16);
|
||||
@@ -462,9 +465,8 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
|
||||
channels = (element == TYPE_CPE) ? 2 : 1;
|
||||
if ( ch + channels > alac->channels
|
||||
|| ff_alac_channel_layout_offsets[alac->channels - 1][ch] + channels > alac->channels
|
||||
) {
|
||||
if (ch + channels > alac->channels ||
|
||||
ff_alac_channel_layout_offsets[alac->channels - 1][ch] + channels > alac->channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "invalid element channel count\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -546,7 +548,8 @@ static int alac_set_info(ALACContext *alac)
|
||||
bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4
|
||||
|
||||
alac->max_samples_per_frame = bytestream2_get_be32u(&gb);
|
||||
if (!alac->max_samples_per_frame || alac->max_samples_per_frame > INT_MAX) {
|
||||
if (!alac->max_samples_per_frame ||
|
||||
alac->max_samples_per_frame > INT_MAX / sizeof(int32_t)) {
|
||||
av_log(alac->avctx, AV_LOG_ERROR, "max samples per frame invalid: %u\n",
|
||||
alac->max_samples_per_frame);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
@@ -275,7 +275,7 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch)
|
||||
// generate warm-up samples
|
||||
residual[0] = samples[0];
|
||||
for (i = 1; i <= lpc.lpc_order; i++)
|
||||
residual[i] = samples[i] - samples[i-1];
|
||||
residual[i] = sign_extend(samples[i] - samples[i-1], s->write_sample_size);
|
||||
|
||||
// perform lpc on remaining samples
|
||||
for (i = lpc.lpc_order + 1; i < s->frame_size; i++) {
|
||||
|
@@ -296,12 +296,12 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
avctx->extradata_size * 8, 1);
|
||||
|
||||
if (config_offset < 0)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
skip_bits_long(&gb, config_offset);
|
||||
|
||||
if (get_bits_left(&gb) < (30 << 3))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
// read the fixed items
|
||||
als_id = get_bits_long(&gb, 32);
|
||||
@@ -336,7 +336,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
|
||||
// check for ALSSpecificConfig struct
|
||||
if (als_id != MKBETAG('A','L','S','\0'))
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ctx->cur_frame_length = sconf->frame_length;
|
||||
|
||||
@@ -351,7 +351,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
int chan_pos_bits = av_ceil_log2(avctx->channels);
|
||||
int bits_needed = avctx->channels * chan_pos_bits + 7;
|
||||
if (get_bits_left(&gb) < bits_needed)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos))))
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -377,7 +377,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
// read fixed header and trailer sizes,
|
||||
// if size = 0xFFFFFFFF then there is no data field!
|
||||
if (get_bits_left(&gb) < 64)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
header_size = get_bits_long(&gb, 32);
|
||||
trailer_size = get_bits_long(&gb, 32);
|
||||
@@ -391,10 +391,10 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
|
||||
// skip the header and trailer data
|
||||
if (get_bits_left(&gb) < ht_size)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (ht_size > INT32_MAX)
|
||||
return -1;
|
||||
return AVERROR_PATCHWELCOME;
|
||||
|
||||
skip_bits_long(&gb, ht_size);
|
||||
|
||||
@@ -402,7 +402,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
|
||||
// initialize CRC calculation
|
||||
if (sconf->crc_enabled) {
|
||||
if (get_bits_left(&gb) < 32)
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) {
|
||||
ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
|
||||
@@ -646,7 +646,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
if (bd->block_length & (sub_blocks - 1)) {
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"Block length is not evenly divisible by the number of subblocks.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
sb_length = bd->block_length >> log2_sub_blocks;
|
||||
@@ -983,14 +983,13 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
*bd->shift_lsbs = 0;
|
||||
// read block type flag and read the samples accordingly
|
||||
if (get_bits1(gb)) {
|
||||
if ((ret = read_var_block_data(ctx, bd)) < 0)
|
||||
return ret;
|
||||
ret = read_var_block_data(ctx, bd);
|
||||
} else {
|
||||
if ((ret = read_const_block_data(ctx, bd)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -999,12 +998,16 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
{
|
||||
unsigned int smp;
|
||||
int ret = 0;
|
||||
|
||||
// read block type flag and read the samples accordingly
|
||||
if (*bd->const_block)
|
||||
decode_const_block_data(ctx, bd);
|
||||
else if (decode_var_block_data(ctx, bd))
|
||||
return -1;
|
||||
else
|
||||
ret = decode_var_block_data(ctx, bd); // always return 0
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
// TODO: read RLSLMS extension data
|
||||
|
||||
@@ -1022,14 +1025,10 @@ static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = read_block(ctx, bd);
|
||||
|
||||
if (ret)
|
||||
if ((ret = read_block(ctx, bd)) < 0)
|
||||
return ret;
|
||||
|
||||
ret = decode_block(ctx, bd);
|
||||
|
||||
return ret;
|
||||
return decode_block(ctx, bd);
|
||||
}
|
||||
|
||||
|
||||
@@ -1055,6 +1054,7 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
|
||||
unsigned int c, const unsigned int *div_blocks,
|
||||
unsigned int *js_blocks)
|
||||
{
|
||||
int ret;
|
||||
unsigned int b;
|
||||
ALSBlockData bd = { 0 };
|
||||
|
||||
@@ -1075,10 +1075,10 @@ static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
|
||||
for (b = 0; b < ctx->num_blocks; b++) {
|
||||
bd.block_length = div_blocks[b];
|
||||
|
||||
if (read_decode_block(ctx, &bd)) {
|
||||
if ((ret = read_decode_block(ctx, &bd)) < 0) {
|
||||
// damaged block, write zero for the rest of the frame
|
||||
zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples);
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
bd.raw_samples += div_blocks[b];
|
||||
bd.ra_block = 0;
|
||||
@@ -1097,6 +1097,7 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
|
||||
ALSSpecificConfig *sconf = &ctx->sconf;
|
||||
unsigned int offset = 0;
|
||||
unsigned int b;
|
||||
int ret;
|
||||
ALSBlockData bd[2] = { { 0 } };
|
||||
|
||||
bd[0].ra_block = ra_frame;
|
||||
@@ -1138,12 +1139,9 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
|
||||
bd[0].raw_other = bd[1].raw_samples;
|
||||
bd[1].raw_other = bd[0].raw_samples;
|
||||
|
||||
if(read_decode_block(ctx, &bd[0]) || read_decode_block(ctx, &bd[1])) {
|
||||
// damaged block, write zero for the rest of the frame
|
||||
zero_remaining(b, ctx->num_blocks, div_blocks, bd[0].raw_samples);
|
||||
zero_remaining(b, ctx->num_blocks, div_blocks, bd[1].raw_samples);
|
||||
return -1;
|
||||
}
|
||||
if ((ret = read_decode_block(ctx, &bd[0])) < 0 ||
|
||||
(ret = read_decode_block(ctx, &bd[1])) < 0)
|
||||
goto fail;
|
||||
|
||||
// reconstruct joint-stereo blocks
|
||||
if (bd[0].js_blocks) {
|
||||
@@ -1169,8 +1167,19 @@ static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
|
||||
sizeof(*ctx->raw_samples[c]) * sconf->max_order);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
// damaged block, write zero for the rest of the frame
|
||||
zero_remaining(b, ctx->num_blocks, div_blocks, bd[0].raw_samples);
|
||||
zero_remaining(b, ctx->num_blocks, div_blocks, bd[1].raw_samples);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int als_weighting(GetBitContext *gb, int k, int off)
|
||||
{
|
||||
int idx = av_clip(decode_rice(gb, k) + off,
|
||||
0, FF_ARRAY_ELEMS(mcc_weightings) - 1);
|
||||
return mcc_weightings[idx];
|
||||
}
|
||||
|
||||
/** Read the channel data.
|
||||
*/
|
||||
@@ -1186,19 +1195,19 @@ static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c)
|
||||
|
||||
if (current->master_channel >= channels) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (current->master_channel != c) {
|
||||
current->time_diff_flag = get_bits1(gb);
|
||||
current->weighting[0] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
|
||||
current->weighting[1] = mcc_weightings[av_clip(decode_rice(gb, 2) + 14, 0, 31)];
|
||||
current->weighting[2] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
|
||||
current->weighting[0] = als_weighting(gb, 1, 16);
|
||||
current->weighting[1] = als_weighting(gb, 2, 14);
|
||||
current->weighting[2] = als_weighting(gb, 1, 16);
|
||||
|
||||
if (current->time_diff_flag) {
|
||||
current->weighting[3] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
|
||||
current->weighting[4] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
|
||||
current->weighting[5] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 31)];
|
||||
current->weighting[3] = als_weighting(gb, 1, 16);
|
||||
current->weighting[4] = als_weighting(gb, 1, 16);
|
||||
current->weighting[5] = als_weighting(gb, 1, 16);
|
||||
|
||||
current->time_diff_sign = get_bits1(gb);
|
||||
current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3;
|
||||
@@ -1211,7 +1220,7 @@ static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c)
|
||||
|
||||
if (entries == channels) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
align_get_bits(gb);
|
||||
@@ -1243,7 +1252,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
|
||||
|
||||
if (dep == channels) {
|
||||
av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
bd->const_block = ctx->const_block + c;
|
||||
@@ -1314,8 +1323,8 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
unsigned int div_blocks[32]; ///< block sizes.
|
||||
unsigned int c;
|
||||
unsigned int js_blocks[2];
|
||||
|
||||
uint32_t bs_info = 0;
|
||||
int ret;
|
||||
|
||||
// skip the size of the ra unit if present in the frame
|
||||
if (sconf->ra_flag == RA_FLAG_FRAMES && ra_frame)
|
||||
@@ -1346,13 +1355,15 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
independent_bs = 1;
|
||||
|
||||
if (independent_bs) {
|
||||
if (decode_blocks_ind(ctx, ra_frame, c, div_blocks, js_blocks))
|
||||
return -1;
|
||||
|
||||
ret = decode_blocks_ind(ctx, ra_frame, c,
|
||||
div_blocks, js_blocks);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
independent_bs--;
|
||||
} else {
|
||||
if (decode_blocks(ctx, ra_frame, c, div_blocks, js_blocks))
|
||||
return -1;
|
||||
ret = decode_blocks(ctx, ra_frame, c, div_blocks, js_blocks);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -1371,7 +1382,7 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
for (c = 0; c < avctx->channels; c++)
|
||||
if (ctx->chan_data[c] < ctx->chan_data_buffer) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid channel data.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels);
|
||||
@@ -1403,11 +1414,12 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (c = 0; c < avctx->channels; c++)
|
||||
if (revert_channel_correlation(ctx, &bd, ctx->chan_data,
|
||||
reverted_channels, offset, c))
|
||||
return -1;
|
||||
|
||||
for (c = 0; c < avctx->channels; c++) {
|
||||
ret = revert_channel_correlation(ctx, &bd, ctx->chan_data,
|
||||
reverted_channels, offset, c);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
for (c = 0; c < avctx->channels; c++) {
|
||||
bd.const_block = ctx->const_block + c;
|
||||
bd.shift_lsbs = ctx->shift_lsbs + c;
|
||||
@@ -1612,30 +1624,30 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
unsigned int c;
|
||||
unsigned int channel_size;
|
||||
int num_buffers;
|
||||
int num_buffers, ret;
|
||||
ALSDecContext *ctx = avctx->priv_data;
|
||||
ALSSpecificConfig *sconf = &ctx->sconf;
|
||||
ctx->avctx = avctx;
|
||||
|
||||
if (!avctx->extradata) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Missing required ALS extradata.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (read_specific_config(ctx)) {
|
||||
if ((ret = read_specific_config(ctx)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Reading ALSSpecificConfig failed.\n");
|
||||
decode_end(avctx);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (check_specific_config(ctx)) {
|
||||
decode_end(avctx);
|
||||
return -1;
|
||||
if ((ret = check_specific_config(ctx)) < 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (sconf->bgmc)
|
||||
ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status);
|
||||
|
||||
if (sconf->bgmc) {
|
||||
ret = ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
}
|
||||
if (sconf->floating) {
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
avctx->bits_per_raw_sample = 32;
|
||||
@@ -1670,7 +1682,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
!ctx->quant_cof_buffer || !ctx->lpc_cof_buffer ||
|
||||
!ctx->lpc_cof_reversed_buffer) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
|
||||
return AVERROR(ENOMEM);
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// assign quantized parcor coefficient buffers
|
||||
@@ -1695,8 +1708,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
!ctx->use_ltp || !ctx->ltp_lag ||
|
||||
!ctx->ltp_gain || !ctx->ltp_gain_buffer) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
|
||||
decode_end(avctx);
|
||||
return AVERROR(ENOMEM);
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (c = 0; c < num_buffers; c++)
|
||||
@@ -1713,8 +1726,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
if (!ctx->chan_data_buffer || !ctx->chan_data || !ctx->reverted_channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
|
||||
decode_end(avctx);
|
||||
return AVERROR(ENOMEM);
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (c = 0; c < num_buffers; c++)
|
||||
@@ -1734,8 +1747,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
// allocate previous raw sample buffer
|
||||
if (!ctx->prev_raw_samples || !ctx->raw_buffer|| !ctx->raw_samples) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
|
||||
decode_end(avctx);
|
||||
return AVERROR(ENOMEM);
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// assign raw samples buffers
|
||||
@@ -1752,8 +1765,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
av_get_bytes_per_sample(avctx->sample_fmt));
|
||||
if (!ctx->crc_buffer) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
|
||||
decode_end(avctx);
|
||||
return AVERROR(ENOMEM);
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1763,6 +1776,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
avctx->coded_frame = &ctx->frame;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
decode_end(avctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -282,6 +282,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;
|
||||
int i;
|
||||
|
||||
if (avctx->extradata_size < 1) {
|
||||
av_log(avctx, AV_LOG_ERROR, "No extradata provided\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ff_asv_common_init(avctx);
|
||||
init_vlcs(a);
|
||||
ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_asv_scantab);
|
||||
|
@@ -165,7 +165,10 @@ static int decode_bytes(const uint8_t *input, uint8_t *out, int bytes)
|
||||
|
||||
off = (intptr_t)input & 3;
|
||||
buf = (const uint32_t *)(input - off);
|
||||
c = av_be2ne32((0x537F6103 >> (off * 8)) | (0x537F6103 << (32 - (off * 8))));
|
||||
if (off)
|
||||
c = av_be2ne32((0x537F6103U >> (off * 8)) | (0x537F6103U << (32 - (off * 8))));
|
||||
else
|
||||
c = av_be2ne32(0x537F6103U);
|
||||
bytes += 3 + off;
|
||||
for (i = 0; i < bytes / 4; i++)
|
||||
output[i] = c ^ buf[i];
|
||||
@@ -662,8 +665,8 @@ static int decode_channel_sound_unit(ATRAC3Context *q, GetBitContext *gb,
|
||||
|
||||
snd->num_components = decode_tonal_components(gb, snd->components,
|
||||
snd->bands_coded);
|
||||
if (snd->num_components == -1)
|
||||
return -1;
|
||||
if (snd->num_components < 0)
|
||||
return snd->num_components;
|
||||
|
||||
num_subbands = decode_spectrum(gb, snd->spectrum);
|
||||
|
||||
@@ -740,7 +743,7 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
|
||||
|
||||
|
||||
/* set the bitstream reader at the start of the second Sound Unit*/
|
||||
init_get_bits(&q->gb, ptr1, avctx->block_align * 8);
|
||||
init_get_bits(&q->gb, ptr1, (avctx->block_align - i) * 8);
|
||||
|
||||
/* Fill the Weighting coeffs delay buffer */
|
||||
memmove(q->weighting_delay, &q->weighting_delay[2],
|
||||
@@ -949,9 +952,11 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
|
||||
|
||||
if (q->coding_mode == STEREO)
|
||||
av_log(avctx, AV_LOG_DEBUG, "Normal stereo detected.\n");
|
||||
else if (q->coding_mode == JOINT_STEREO)
|
||||
else if (q->coding_mode == JOINT_STEREO) {
|
||||
if (avctx->channels != 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(avctx, AV_LOG_DEBUG, "Joint stereo detected.\n");
|
||||
else {
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown channel coding mode %x!\n",
|
||||
q->coding_mode);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
@@ -170,7 +170,7 @@ static void init_lengths(BinkContext *c, int width, int bw)
|
||||
*
|
||||
* @param c decoder context
|
||||
*/
|
||||
static av_cold void init_bundles(BinkContext *c)
|
||||
static av_cold int init_bundles(BinkContext *c)
|
||||
{
|
||||
int bw, bh, blocks;
|
||||
int i;
|
||||
@@ -181,8 +181,12 @@ static av_cold void init_bundles(BinkContext *c)
|
||||
|
||||
for (i = 0; i < BINKB_NB_SRC; i++) {
|
||||
c->bundle[i].data = av_malloc(blocks * 64);
|
||||
if (!c->bundle[i].data)
|
||||
return AVERROR(ENOMEM);
|
||||
c->bundle[i].data_end = c->bundle[i].data + blocks * 64;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -681,6 +685,9 @@ static int read_dct_coeffs(GetBitContext *gb, int32_t block[64], const uint8_t *
|
||||
}
|
||||
}
|
||||
|
||||
if (quant_idx >= 16)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
quant = quant_matrices[quant_idx];
|
||||
|
||||
block[0] = (block[0] * quant[0]) >> 11;
|
||||
@@ -1264,7 +1271,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
BinkContext * const c = avctx->priv_data;
|
||||
static VLC_TYPE table[16 * 128][2];
|
||||
static int binkb_initialised = 0;
|
||||
int i;
|
||||
int i, ret;
|
||||
int flags;
|
||||
|
||||
c->version = avctx->codec_tag >> 24;
|
||||
@@ -1299,7 +1306,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
ff_dsputil_init(&c->dsp, avctx);
|
||||
ff_binkdsp_init(&c->bdsp);
|
||||
|
||||
init_bundles(c);
|
||||
if ((ret = init_bundles(c)) < 0) {
|
||||
free_bundles(c);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (c->version == 'b') {
|
||||
if (!binkb_initialised) {
|
||||
|
@@ -140,7 +140,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
|
||||
mode += 1 + advance_mode;
|
||||
if (mode >= 4)
|
||||
mode -= 3;
|
||||
if (FFABS(dst_end - dst) < len)
|
||||
if (len <= 0 || FFABS(dst_end - dst) < len)
|
||||
return -1;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
|
@@ -944,6 +944,11 @@ static int decode_pic(AVSContext *h)
|
||||
int ret;
|
||||
enum cavs_mb mb_type;
|
||||
|
||||
if (!h->top_qp) {
|
||||
av_log(h->avctx, AV_LOG_ERROR, "No sequence header decoded yet\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
skip_bits(&h->gb, 16);//bbv_dwlay
|
||||
if (h->stc == PIC_PB_START_CODE) {
|
||||
h->cur.f->pict_type = get_bits(&h->gb, 2) + AV_PICTURE_TYPE_I;
|
||||
|
@@ -296,7 +296,9 @@ static int cdg_decode_frame(AVCodecContext *avctx,
|
||||
inst = bytestream_get_byte(&buf);
|
||||
inst &= CDG_MASK;
|
||||
buf += 2; /// skipping 2 unneeded bytes
|
||||
bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
|
||||
|
||||
if (buf_size > CDG_HEADER_SIZE)
|
||||
bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
|
||||
|
||||
if ((command & CDG_MASK) == CDG_COMMAND) {
|
||||
switch (inst) {
|
||||
|
@@ -738,10 +738,10 @@ static int dca_parse_frame_header(DCAContext *s)
|
||||
s->lfe = get_bits(&s->gb, 2);
|
||||
s->predictor_history = get_bits(&s->gb, 1);
|
||||
|
||||
if (s->lfe == 3) {
|
||||
if (s->lfe > 2) {
|
||||
s->lfe = 0;
|
||||
av_log_ask_for_sample(s->avctx, "LFE is 3\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid LFE value: %d\n", s->lfe);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* TODO: check CRC */
|
||||
@@ -971,7 +971,13 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
|
||||
"Invalid channel mode %d\n", am);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (j = base_channel; j < FFMIN(s->prim_channels, FF_ARRAY_ELEMS(dca_default_coeffs[am])); j++) {
|
||||
if (s->prim_channels > FF_ARRAY_ELEMS(dca_default_coeffs[0])) {
|
||||
av_log_ask_for_sample(s->avctx, "Downmixing %d channels",
|
||||
s->prim_channels);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
for (j = base_channel; j < s->prim_channels; j++) {
|
||||
s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
|
||||
s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
|
||||
}
|
||||
@@ -1425,6 +1431,7 @@ static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
|
||||
#endif
|
||||
} else {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -263,6 +263,8 @@ static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height
|
||||
segments = bytestream2_get_le16(gb);
|
||||
}
|
||||
line_ptr = frame;
|
||||
if (frame_end - frame < width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
frame += width;
|
||||
y++;
|
||||
while (segments--) {
|
||||
|
@@ -406,7 +406,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
|
||||
*picture = ctx->picture;
|
||||
*got_frame = 1;
|
||||
return buf_size;
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
|
||||
|
@@ -629,14 +629,35 @@ static void dnxhd_setup_threads_slices(DNXHDEncContext *ctx)
|
||||
static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
|
||||
{
|
||||
DNXHDEncContext *ctx = avctx->priv_data;
|
||||
int mb_y = jobnr, mb_x;
|
||||
int mb_y = jobnr, mb_x, x, y;
|
||||
int partial_last_row = (mb_y == ctx->m.mb_height - 1) &&
|
||||
((avctx->height >> ctx->interlaced) & 0xF);
|
||||
|
||||
ctx = ctx->thread[threadnr];
|
||||
if (ctx->cid_table->bit_depth == 8) {
|
||||
uint8_t *pix = ctx->thread[0]->src[0] + ((mb_y<<4) * ctx->m.linesize);
|
||||
for (mb_x = 0; mb_x < ctx->m.mb_width; ++mb_x, pix += 16) {
|
||||
unsigned mb = mb_y * ctx->m.mb_width + mb_x;
|
||||
int sum = ctx->m.dsp.pix_sum(pix, ctx->m.linesize);
|
||||
int varc = (ctx->m.dsp.pix_norm1(pix, ctx->m.linesize) - (((unsigned)sum*sum)>>8)+128)>>8;
|
||||
int sum;
|
||||
int varc;
|
||||
|
||||
if (!partial_last_row && mb_x * 16 <= avctx->width - 16) {
|
||||
sum = ctx->m.dsp.pix_sum(pix, ctx->m.linesize);
|
||||
varc = ctx->m.dsp.pix_norm1(pix, ctx->m.linesize);
|
||||
} else {
|
||||
int bw = FFMIN(avctx->width - 16 * mb_x, 16);
|
||||
int bh = FFMIN((avctx->height >> ctx->interlaced) - 16 * mb_y, 16);
|
||||
sum = varc = 0;
|
||||
for (y = 0; y < bh; y++) {
|
||||
for (x = 0; x < bw; x++) {
|
||||
uint8_t val = pix[x + y * ctx->m.linesize];
|
||||
sum += val;
|
||||
varc += val * val;
|
||||
}
|
||||
}
|
||||
}
|
||||
varc = (varc - (((unsigned)sum * sum) >> 8) + 128) >> 8;
|
||||
|
||||
ctx->mb_cmp[mb].value = varc;
|
||||
ctx->mb_cmp[mb].mb = mb;
|
||||
}
|
||||
|
@@ -212,6 +212,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
buf[803] = s->bits_per_component;
|
||||
write16(buf + 804, (s->bits_per_component == 10 || s->bits_per_component == 12) ?
|
||||
1 : 0); /* packing method */
|
||||
write32(buf + 808, HEADER_SIZE); /* data offset */
|
||||
|
||||
/* Image source information header */
|
||||
write32(buf + 1628, avctx->sample_aspect_ratio.num);
|
||||
|
@@ -128,27 +128,30 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cin_apply_delta_data(const unsigned char *src, unsigned char *dst, int size)
|
||||
static void cin_apply_delta_data(const unsigned char *src, unsigned char *dst,
|
||||
int size)
|
||||
{
|
||||
while (size--)
|
||||
*dst++ += *src++;
|
||||
}
|
||||
|
||||
static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
|
||||
static int cin_decode_huffman(const unsigned char *src, int src_size,
|
||||
unsigned char *dst, int dst_size)
|
||||
{
|
||||
int b, huff_code = 0;
|
||||
unsigned char huff_code_table[15];
|
||||
unsigned char *dst_cur = dst;
|
||||
unsigned char *dst_end = dst + dst_size;
|
||||
unsigned char *dst_cur = dst;
|
||||
unsigned char *dst_end = dst + dst_size;
|
||||
const unsigned char *src_end = src + src_size;
|
||||
|
||||
memcpy(huff_code_table, src, 15); src += 15;
|
||||
memcpy(huff_code_table, src, 15);
|
||||
src += 15;
|
||||
|
||||
while (src < src_end) {
|
||||
huff_code = *src++;
|
||||
if ((huff_code >> 4) == 15) {
|
||||
b = huff_code << 4;
|
||||
huff_code = *src++;
|
||||
b = huff_code << 4;
|
||||
huff_code = *src++;
|
||||
*dst_cur++ = b | (huff_code >> 4);
|
||||
} else
|
||||
*dst_cur++ = huff_code_table[huff_code >> 4];
|
||||
@@ -167,11 +170,12 @@ static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned c
|
||||
return dst_cur - dst;
|
||||
}
|
||||
|
||||
static int cin_decode_lzss(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
|
||||
static int cin_decode_lzss(const unsigned char *src, int src_size,
|
||||
unsigned char *dst, int dst_size)
|
||||
{
|
||||
uint16_t cmd;
|
||||
int i, sz, offset, code;
|
||||
unsigned char *dst_end = dst + dst_size, *dst_start = dst;
|
||||
unsigned char *dst_end = dst + dst_size, *dst_start = dst;
|
||||
const unsigned char *src_end = src + src_size;
|
||||
|
||||
while (src < src_end && dst < dst_end) {
|
||||
@@ -180,13 +184,15 @@ static int cin_decode_lzss(const unsigned char *src, int src_size, unsigned char
|
||||
if (code & (1 << i)) {
|
||||
*dst++ = *src++;
|
||||
} else {
|
||||
cmd = AV_RL16(src); src += 2;
|
||||
cmd = AV_RL16(src);
|
||||
src += 2;
|
||||
offset = cmd >> 4;
|
||||
if ((int) (dst - dst_start) < offset + 1)
|
||||
if ((int)(dst - dst_start) < offset + 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
sz = (cmd & 0xF) + 2;
|
||||
/* don't use memcpy/memmove here as the decoding routine (ab)uses */
|
||||
/* buffer overlappings to repeat bytes in the destination */
|
||||
/* don't use memcpy/memmove here as the decoding routine
|
||||
* (ab)uses buffer overlappings to repeat bytes in the
|
||||
* destination */
|
||||
sz = FFMIN(sz, dst_end - dst);
|
||||
while (sz--) {
|
||||
*dst = *(dst - offset - 1);
|
||||
@@ -199,10 +205,11 @@ static int cin_decode_lzss(const unsigned char *src, int src_size, unsigned char
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cin_decode_rle(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
|
||||
static int cin_decode_rle(const unsigned char *src, int src_size,
|
||||
unsigned char *dst, int dst_size)
|
||||
{
|
||||
int len, code;
|
||||
unsigned char *dst_end = dst + dst_size;
|
||||
unsigned char *dst_end = dst + dst_size;
|
||||
const unsigned char *src_end = src + src_size;
|
||||
|
||||
while (src + 1 < src_end && dst < dst_end) {
|
||||
@@ -216,7 +223,7 @@ static int cin_decode_rle(const unsigned char *src, int src_size, unsigned char
|
||||
av_log(NULL, AV_LOG_ERROR, "RLE overread\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
memcpy(dst, src, FFMIN(len, dst_end - dst));
|
||||
memcpy(dst, src, FFMIN3(len, dst_end - dst, src_end - src));
|
||||
src += len;
|
||||
}
|
||||
dst += len;
|
||||
@@ -228,15 +235,16 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *got_frame,
|
||||
AVPacket *avpkt)
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
CinVideoContext *cin = avctx->priv_data;
|
||||
int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size, res = 0;
|
||||
int i, y, palette_type, palette_colors_count,
|
||||
bitmap_frame_type, bitmap_frame_size, res = 0;
|
||||
|
||||
palette_type = buf[0];
|
||||
palette_colors_count = AV_RL16(buf+1);
|
||||
bitmap_frame_type = buf[3];
|
||||
buf += 4;
|
||||
palette_type = buf[0];
|
||||
palette_colors_count = AV_RL16(buf + 1);
|
||||
bitmap_frame_type = buf[3];
|
||||
buf += 4;
|
||||
|
||||
bitmap_frame_size = buf_size - 4;
|
||||
|
||||
@@ -247,46 +255,50 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
|
||||
if (palette_colors_count > 256)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = 0; i < palette_colors_count; ++i) {
|
||||
cin->palette[i] = 0xFFU << 24 | bytestream_get_le24(&buf);
|
||||
cin->palette[i] = 0xFFU << 24 | bytestream_get_le24(&buf);
|
||||
bitmap_frame_size -= 3;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < palette_colors_count; ++i) {
|
||||
cin->palette[buf[0]] = 0xFFU << 24 | AV_RL24(buf+1);
|
||||
cin->palette[buf[0]] = 0xFFU << 24 | AV_RL24(buf + 1);
|
||||
buf += 4;
|
||||
bitmap_frame_size -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
/* note: the decoding routines below assumes that surface.width = surface.pitch */
|
||||
bitmap_frame_size = FFMIN(cin->bitmap_size, bitmap_frame_size);
|
||||
|
||||
/* note: the decoding routines below assumes that
|
||||
* surface.width = surface.pitch */
|
||||
switch (bitmap_frame_type) {
|
||||
case 9:
|
||||
cin_decode_rle(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
case 34:
|
||||
cin_decode_rle(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
case 35:
|
||||
bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
|
||||
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
case 36:
|
||||
bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_INT_BMP],
|
||||
cin->bitmap_size);
|
||||
cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
case 37:
|
||||
cin_decode_huffman(buf, bitmap_frame_size,
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
case 38:
|
||||
res = cin_decode_lzss(buf, bitmap_frame_size,
|
||||
@@ -302,12 +314,12 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
|
||||
if (res < 0)
|
||||
return res;
|
||||
cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
|
||||
break;
|
||||
}
|
||||
|
||||
cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
|
||||
if ((res = avctx->reget_buffer(avctx, &cin->frame))) {
|
||||
if ((res = avctx->reget_buffer(avctx, &cin->frame)) < 0) {
|
||||
av_log(cin->avctx, AV_LOG_ERROR, "failed to allocate a frame\n");
|
||||
return res;
|
||||
}
|
||||
@@ -316,10 +328,11 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
|
||||
cin->frame.palette_has_changed = 1;
|
||||
for (y = 0; y < cin->avctx->height; ++y)
|
||||
memcpy(cin->frame.data[0] + (cin->avctx->height - 1 - y) * cin->frame.linesize[0],
|
||||
cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,
|
||||
cin->avctx->width);
|
||||
cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,
|
||||
cin->avctx->width);
|
||||
|
||||
FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]);
|
||||
FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP],
|
||||
cin->bitmap_table[CIN_PRE_BMP]);
|
||||
|
||||
*got_frame = 1;
|
||||
*(AVFrame *)data = cin->frame;
|
||||
@@ -358,8 +371,8 @@ static av_cold int cinaudio_decode_init(AVCodecContext *avctx)
|
||||
static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int *got_frame_ptr, AVPacket *avpkt)
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
CinAudioContext *cin = avctx->priv_data;
|
||||
const uint8_t *buf = avpkt->data;
|
||||
CinAudioContext *cin = avctx->priv_data;
|
||||
const uint8_t *buf_end = buf + avpkt->size;
|
||||
int16_t *samples;
|
||||
int delta, ret;
|
||||
@@ -375,13 +388,13 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
|
||||
delta = cin->delta;
|
||||
if (cin->initial_decode_frame) {
|
||||
cin->initial_decode_frame = 0;
|
||||
delta = sign_extend(AV_RL16(buf), 16);
|
||||
buf += 2;
|
||||
*samples++ = delta;
|
||||
delta = sign_extend(AV_RL16(buf), 16);
|
||||
buf += 2;
|
||||
*samples++ = delta;
|
||||
}
|
||||
while (buf < buf_end) {
|
||||
delta += cinaudio_delta16_table[*buf++];
|
||||
delta = av_clip_int16(delta);
|
||||
delta += cinaudio_delta16_table[*buf++];
|
||||
delta = av_clip_int16(delta);
|
||||
*samples++ = delta;
|
||||
}
|
||||
cin->delta = delta;
|
||||
@@ -392,7 +405,6 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return avpkt->size;
|
||||
}
|
||||
|
||||
|
||||
AVCodec ff_dsicinvideo_decoder = {
|
||||
.name = "dsicinvideo",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
|
@@ -1922,7 +1922,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
|
||||
|
||||
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
|
||||
long i;
|
||||
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
|
||||
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
|
||||
long a = *(long*)(src+i);
|
||||
long b = *(long*)(dst+i);
|
||||
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
|
||||
@@ -1947,7 +1947,7 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
|
||||
}
|
||||
}else
|
||||
#endif
|
||||
for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
|
||||
for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
|
||||
long a = *(long*)(src1+i);
|
||||
long b = *(long*)(src2+i);
|
||||
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
|
||||
|
@@ -350,11 +350,6 @@ static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
|
||||
static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5;
|
||||
static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
|
||||
|
||||
static inline int put_bits_left(PutBitContext* s)
|
||||
{
|
||||
return (s->buf_end - s->buf) * 8 - put_bits_count(s);
|
||||
}
|
||||
|
||||
#if CONFIG_SMALL
|
||||
/* Converts run and level (where level != 0) pair into VLC, returning bit size */
|
||||
static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc)
|
||||
|
@@ -255,6 +255,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
case 5:
|
||||
c->pic.key_frame = !(compr & 1);
|
||||
c->pic.pict_type = (compr & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
|
||||
|
||||
if (!tmpptr && !c->pic.key_frame) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for(j = 0; j < avctx->height; j++){
|
||||
if((compr & 1) && tmpptr){
|
||||
for(i = 0; i < avctx->width; i++)
|
||||
|
@@ -114,8 +114,8 @@ static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *
|
||||
int yoffset = ((buf[i] >> 4)) - 7;
|
||||
if (s->last_frame.data[0])
|
||||
cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
|
||||
s->last_frame.data[0], s->last_frame.linesize[0],
|
||||
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
|
||||
s->last_frame.data[0], s->last_frame.linesize[0],
|
||||
x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@@ -276,6 +276,21 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
}
|
||||
|
||||
if (inter && !s->last_frame.data[0]) {
|
||||
int ret;
|
||||
av_log(avctx, AV_LOG_WARNING, "Missing reference frame.\n");
|
||||
s->last_frame.reference = 1;
|
||||
ret = ff_get_buffer(avctx, &s->last_frame);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
memset(s->last_frame.data[0], 0, s->last_frame.height *
|
||||
s->last_frame.linesize[0]);
|
||||
memset(s->last_frame.data[1], 0x80, s->last_frame.height / 2 *
|
||||
s->last_frame.linesize[1]);
|
||||
memset(s->last_frame.data[2], 0x80, s->last_frame.height / 2 *
|
||||
s->last_frame.linesize[2]);
|
||||
}
|
||||
|
||||
av_fast_padded_malloc(&s->bitstream_buf, &s->bitstream_buf_size,
|
||||
buf_end - buf);
|
||||
if (!s->bitstream_buf)
|
||||
|
@@ -447,6 +447,10 @@ static int read_extra_header(FFV1Context *f)
|
||||
ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
|
||||
|
||||
f->version = get_symbol(c, state, 0);
|
||||
if (f->version < 2) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (f->version > 2) {
|
||||
c->bytestream_end -= 4;
|
||||
f->minor_version = get_symbol(c, state, 0);
|
||||
@@ -524,6 +528,7 @@ static int read_header(FFV1Context *f)
|
||||
memset(state, 128, sizeof(state));
|
||||
|
||||
if (f->version < 2) {
|
||||
int chroma_planes, chroma_h_shift, chroma_v_shift, transparency, colorspace, bits_per_raw_sample;
|
||||
unsigned v= get_symbol(c, state, 0);
|
||||
if (v >= 2) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "invalid version %d in ver01 header\n", v);
|
||||
@@ -536,15 +541,32 @@ static int read_header(FFV1Context *f)
|
||||
f->state_transition[i] = get_symbol(c, state, 1) + c->one_state[i];
|
||||
}
|
||||
|
||||
f->colorspace = get_symbol(c, state, 0); //YUV cs type
|
||||
colorspace = get_symbol(c, state, 0); //YUV cs type
|
||||
bits_per_raw_sample = f->version > 0 ? get_symbol(c, state, 0) : f->avctx->bits_per_raw_sample;
|
||||
chroma_planes = get_rac(c, state);
|
||||
chroma_h_shift = get_symbol(c, state, 0);
|
||||
chroma_v_shift = get_symbol(c, state, 0);
|
||||
transparency = get_rac(c, state);
|
||||
|
||||
if (f->version > 0)
|
||||
f->avctx->bits_per_raw_sample = get_symbol(c, state, 0);
|
||||
if (f->plane_count) {
|
||||
if ( colorspace != f->colorspace
|
||||
|| bits_per_raw_sample != f->avctx->bits_per_raw_sample
|
||||
|| chroma_planes != f->chroma_planes
|
||||
|| chroma_h_shift!= f->chroma_h_shift
|
||||
|| chroma_v_shift!= f->chroma_v_shift
|
||||
|| transparency != f->transparency) {
|
||||
av_log(f->avctx, AV_LOG_ERROR, "Invalid change of global parameters\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
f->colorspace = colorspace;
|
||||
f->avctx->bits_per_raw_sample = bits_per_raw_sample;
|
||||
f->chroma_planes = chroma_planes;
|
||||
f->chroma_h_shift = chroma_h_shift;
|
||||
f->chroma_v_shift = chroma_v_shift;
|
||||
f->transparency = transparency;
|
||||
|
||||
f->chroma_planes = get_rac(c, state);
|
||||
f->chroma_h_shift = get_symbol(c, state, 0);
|
||||
f->chroma_v_shift = get_symbol(c, state, 0);
|
||||
f->transparency = get_rac(c, state);
|
||||
f->plane_count = 2 + f->transparency;
|
||||
}
|
||||
|
||||
|
@@ -275,7 +275,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w,
|
||||
int run_mode = 0;
|
||||
|
||||
if (s->ac) {
|
||||
if (c->bytestream_end - c->bytestream < w * 20) {
|
||||
if (c->bytestream_end - c->bytestream < w * 35) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ const int ff_flac_sample_rate_table[16] =
|
||||
8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
|
||||
0, 0, 0, 0 };
|
||||
|
||||
const int16_t ff_flac_blocksize_table[16] = {
|
||||
const int32_t ff_flac_blocksize_table[16] = {
|
||||
0, 192, 576<<0, 576<<1, 576<<2, 576<<3, 0, 0,
|
||||
256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7
|
||||
};
|
||||
|
@@ -26,6 +26,6 @@
|
||||
|
||||
extern const int ff_flac_sample_rate_table[16];
|
||||
|
||||
extern const int16_t ff_flac_blocksize_table[16];
|
||||
extern const int32_t ff_flac_blocksize_table[16];
|
||||
|
||||
#endif /* AVCODEC_FLACDATA_H */
|
||||
|
@@ -389,6 +389,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
s->diff_start = get_bits(&gb, 8);
|
||||
s->diff_height = get_bits(&gb, 8);
|
||||
if (s->diff_start + s->diff_height > cur_blk_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Block parameters invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
av_log(avctx, AV_LOG_DEBUG,
|
||||
"%dx%d diff start %d height %d\n",
|
||||
i, j, s->diff_start, s->diff_height);
|
||||
|
@@ -387,6 +387,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
|
||||
if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk)
|
||||
break;
|
||||
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
|
||||
if (!byte_run) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (byte_run > 0) {
|
||||
palette_idx1 = bytestream2_get_byte(&g2);
|
||||
CHECK_PIXEL_PTR(byte_run);
|
||||
|
@@ -145,6 +145,11 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
enum AVPixelFormat pix_fmt;
|
||||
int ret;
|
||||
|
||||
if (buf_size < 4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Packet is too short\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
header = AV_RL32(buf);
|
||||
version = header & 0xff;
|
||||
header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */
|
||||
@@ -216,7 +221,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
switch(version) {
|
||||
switch (version) {
|
||||
case 0:
|
||||
default:
|
||||
/* Fraps v0 is a reordered YUV420 */
|
||||
@@ -226,13 +231,13 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
buf32=(const uint32_t*)buf;
|
||||
for(y=0; y<avctx->height/2; y++){
|
||||
luma1=(uint32_t*)&f->data[0][ y*2*f->linesize[0] ];
|
||||
luma2=(uint32_t*)&f->data[0][ (y*2+1)*f->linesize[0] ];
|
||||
cr=(uint32_t*)&f->data[1][ y*f->linesize[1] ];
|
||||
cb=(uint32_t*)&f->data[2][ y*f->linesize[2] ];
|
||||
for(x=0; x<avctx->width; x+=8){
|
||||
buf32 = (const uint32_t*)buf;
|
||||
for (y = 0; y < avctx->height / 2; y++) {
|
||||
luma1 = (uint32_t*)&f->data[0][ y * 2 * f->linesize[0] ];
|
||||
luma2 = (uint32_t*)&f->data[0][ (y * 2 + 1) * f->linesize[0] ];
|
||||
cr = (uint32_t*)&f->data[1][ y * f->linesize[1] ];
|
||||
cb = (uint32_t*)&f->data[2][ y * f->linesize[2] ];
|
||||
for(x=0; x<avctx->width; x+=8) {
|
||||
*luma1++ = *buf32++;
|
||||
*luma1++ = *buf32++;
|
||||
*luma2++ = *buf32++;
|
||||
@@ -245,10 +250,10 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
|
||||
case 1:
|
||||
/* Fraps v1 is an upside-down BGR24 */
|
||||
for(y=0; y<avctx->height; y++)
|
||||
memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ],
|
||||
&buf[y*avctx->width*3],
|
||||
3*avctx->width);
|
||||
for (y = 0; y < avctx->height; y++)
|
||||
memcpy(&f->data[0][ (avctx->height - y - 1) * f->linesize[0]],
|
||||
&buf[y * avctx->width * 3],
|
||||
3 * avctx->width);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
@@ -75,6 +75,7 @@ typedef struct GifState {
|
||||
|
||||
AVCodecContext *avctx;
|
||||
int keyframe;
|
||||
int keyframe_ok;
|
||||
int trans_color; /**< color value that is used instead of transparent color */
|
||||
} GifState;
|
||||
|
||||
@@ -471,6 +472,8 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A
|
||||
}
|
||||
|
||||
if (s->keyframe) {
|
||||
s->keyframe_ok = 0;
|
||||
s->gce_prev_disposal = GCE_DISPOSAL_NONE;
|
||||
if ((ret = gif_read_header1(s)) < 0)
|
||||
return ret;
|
||||
|
||||
@@ -488,7 +491,13 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A
|
||||
|
||||
s->picture.pict_type = AV_PICTURE_TYPE_I;
|
||||
s->picture.key_frame = 1;
|
||||
s->keyframe_ok = 1;
|
||||
} else {
|
||||
if (!s->keyframe_ok) {
|
||||
av_log(avctx, AV_LOG_ERROR, "cannot decode frame without keyframe\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if ((ret = avctx->reget_buffer(avctx, &s->picture)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
|
||||
return ret;
|
||||
|
@@ -291,9 +291,11 @@ static int h261_decode_mb(H261Context *h){
|
||||
// Read mtype
|
||||
h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2);
|
||||
if (h->mtype < 0) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "illegal mtype %d\n", h->mtype);
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Invalid mtype index %d\n",
|
||||
h->mtype);
|
||||
return SLICE_ERROR;
|
||||
}
|
||||
av_assert0(h->mtype < FF_ARRAY_ELEMS(ff_h261_mtype_map));
|
||||
h->mtype = ff_h261_mtype_map[h->mtype];
|
||||
|
||||
// Read mquant
|
||||
|
@@ -597,17 +597,6 @@ retry:
|
||||
/* FIXME: By the way H263 decoder is evolving it should have */
|
||||
/* an H263EncContext */
|
||||
|
||||
if ((!avctx->coded_width || !avctx->coded_height) && 0) {
|
||||
ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat
|
||||
|
||||
s->parse_context.buffer=0;
|
||||
ff_MPV_common_end(s);
|
||||
s->parse_context= pc;
|
||||
avcodec_set_dimensions(avctx, s->width, s->height);
|
||||
|
||||
goto retry;
|
||||
}
|
||||
|
||||
if (s->width != avctx->coded_width ||
|
||||
s->height != avctx->coded_height ||
|
||||
s->context_reinit) {
|
||||
|
@@ -2443,6 +2443,12 @@ static int h264_set_parameter_from_sps(H264Context *h)
|
||||
if (s->avctx->has_b_frames < 2)
|
||||
s->avctx->has_b_frames = !s->low_delay;
|
||||
|
||||
if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) {
|
||||
av_log_missing_feature(s->avctx,
|
||||
"Different bit depth between chroma and luma", 1);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
|
||||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
|
||||
if (s->avctx->codec &&
|
||||
@@ -2475,7 +2481,7 @@ static int h264_set_parameter_from_sps(H264Context *h)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum PixelFormat get_pixel_format(H264Context *h)
|
||||
static enum PixelFormat get_pixel_format(H264Context *h, int force_callback)
|
||||
{
|
||||
MpegEncContext *const s = &h->s;
|
||||
switch (h->sps.bit_depth_luma) {
|
||||
@@ -2537,11 +2543,17 @@ static enum PixelFormat get_pixel_format(H264Context *h)
|
||||
return s->avctx->color_range == AVCOL_RANGE_JPEG ? AV_PIX_FMT_YUVJ422P
|
||||
: AV_PIX_FMT_YUV422P;
|
||||
} else {
|
||||
return s->avctx->get_format(s->avctx, s->avctx->codec->pix_fmts ?
|
||||
int i;
|
||||
const enum AVPixelFormat * fmt = s->avctx->codec->pix_fmts ?
|
||||
s->avctx->codec->pix_fmts :
|
||||
s->avctx->color_range == AVCOL_RANGE_JPEG ?
|
||||
hwaccel_pixfmt_list_h264_jpeg_420 :
|
||||
ff_hwaccel_pixfmt_list_420);
|
||||
ff_hwaccel_pixfmt_list_420;
|
||||
|
||||
for (i=0; fmt[i] != AV_PIX_FMT_NONE; i++)
|
||||
if (fmt[i] == s->avctx->pix_fmt && !force_callback)
|
||||
return fmt[i];
|
||||
return s->avctx->get_format(s->avctx, fmt);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -2765,7 +2777,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|| s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|
||||
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc
|
||||
|| av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio)));
|
||||
if (h0->s.avctx->pix_fmt != get_pixel_format(h0))
|
||||
if (h0->s.avctx->pix_fmt != get_pixel_format(h0, 0))
|
||||
must_reinit = 1;
|
||||
|
||||
s->mb_width = h->sps.mb_width;
|
||||
@@ -2803,7 +2815,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|
||||
flush_change(h);
|
||||
|
||||
if ((ret = get_pixel_format(h)) < 0)
|
||||
if ((ret = get_pixel_format(h, 1)) < 0)
|
||||
return ret;
|
||||
s->avctx->pix_fmt = ret;
|
||||
|
||||
@@ -2824,7 +2836,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((ret = get_pixel_format(h)) < 0)
|
||||
if ((ret = get_pixel_format(h, 1)) < 0)
|
||||
return ret;
|
||||
s->avctx->pix_fmt = ret;
|
||||
|
||||
@@ -2968,6 +2980,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
|
||||
av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n",
|
||||
h->frame_num, h->prev_frame_num);
|
||||
if (!h->sps.gaps_in_frame_num_allowed_flag)
|
||||
for(i=0; i<FF_ARRAY_ELEMS(h->last_pocs); i++)
|
||||
h->last_pocs[i] = INT_MIN;
|
||||
if (ff_h264_frame_start(h) < 0)
|
||||
return -1;
|
||||
h->prev_frame_num++;
|
||||
@@ -3110,7 +3125,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
|
||||
if (h->ref_count[0]-1 > max[0] || h->ref_count[1]-1 > max[1]){
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow %u > %u or %u > %u\n", h->ref_count[0]-1, max[0], h->ref_count[1]-1, max[1]);
|
||||
h->ref_count[0] = h->ref_count[1] = 1;
|
||||
h->ref_count[0] = h->ref_count[1] = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -3118,8 +3133,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
h->list_count = 2;
|
||||
else
|
||||
h->list_count = 1;
|
||||
} else
|
||||
h->ref_count[1]= h->ref_count[0]= h->list_count= 0;
|
||||
} else {
|
||||
h->list_count = 0;
|
||||
h->ref_count[0] = h->ref_count[1] = 0;
|
||||
}
|
||||
|
||||
if (!default_ref_list_done)
|
||||
ff_h264_fill_default_ref_list(h);
|
||||
|
@@ -709,7 +709,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h){
|
||||
down the code */
|
||||
if(h->slice_type_nos != AV_PICTURE_TYPE_I){
|
||||
if(s->mb_skip_run==-1)
|
||||
s->mb_skip_run= get_ue_golomb(&s->gb);
|
||||
s->mb_skip_run= get_ue_golomb_long(&s->gb);
|
||||
|
||||
if (s->mb_skip_run--) {
|
||||
if(FRAME_MBAFF && (s->mb_y&1) == 0){
|
||||
|
@@ -385,7 +385,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
|
||||
}
|
||||
sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8;
|
||||
sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8;
|
||||
if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U) {
|
||||
if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U || sps->bit_depth_luma != sps->bit_depth_chroma) {
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n",
|
||||
sps->bit_depth_luma, sps->bit_depth_chroma);
|
||||
goto fail;
|
||||
|
@@ -287,7 +287,10 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h){
|
||||
for(list=0; list<h->list_count; list++){
|
||||
for(index= 0; index < h->ref_count[list]; index++){
|
||||
if (!h->ref_list[list][index].f.data[0]) {
|
||||
int i;
|
||||
av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref_list[list][0].poc);
|
||||
for (i=0; i<FF_ARRAY_ELEMS(h->last_pocs); i++)
|
||||
h->last_pocs[i] = INT_MIN;
|
||||
if (h->default_ref_list[list][0].f.data[0])
|
||||
h->ref_list[list][index]= h->default_ref_list[list][0];
|
||||
else
|
||||
|
@@ -451,6 +451,10 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx,
|
||||
iacc += chctx->bandWidthT[i];
|
||||
summa += chctx->bandWidthT[i] * chctx->flcoeffs4[i];
|
||||
}
|
||||
|
||||
if (!iacc)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
chctx->bandWidthT[BANDS - 1] = 0;
|
||||
summa = (summa * 0.5 - freebits) / iacc;
|
||||
|
||||
|
@@ -226,7 +226,7 @@ static av_cold void free_frame_buffers(Indeo3DecodeContext *ctx)
|
||||
* @param plane pointer to the plane descriptor
|
||||
* @param cell pointer to the cell descriptor
|
||||
*/
|
||||
static void copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell)
|
||||
static int copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell)
|
||||
{
|
||||
int h, w, mv_x, mv_y, offset, offset_dst;
|
||||
uint8_t *src, *dst;
|
||||
@@ -239,6 +239,16 @@ static void copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell)
|
||||
mv_x = cell->mv_ptr[1];
|
||||
}else
|
||||
mv_x= mv_y= 0;
|
||||
|
||||
/* -1 because there is an extra line on top for prediction */
|
||||
if ((cell->ypos << 2) + mv_y < -1 || (cell->xpos << 2) + mv_x < 0 ||
|
||||
((cell->ypos + cell->height) << 2) + mv_y > plane->height ||
|
||||
((cell->xpos + cell->width) << 2) + mv_x > plane->width) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"Motion vectors point out of the frame.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
offset = offset_dst + mv_y * plane->pitch + mv_x;
|
||||
src = plane->pixels[ctx->buf_sel ^ 1] + offset;
|
||||
|
||||
@@ -266,15 +276,17 @@ static void copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell)
|
||||
dst += 4;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Average 4/8 pixels at once without rounding using SWAR */
|
||||
#define AVG_32(dst, src, ref) \
|
||||
AV_WN32A(dst, ((AV_RN32A(src) + AV_RN32A(ref)) >> 1) & 0x7F7F7F7FUL)
|
||||
AV_WN32A(dst, ((AV_RN32(src) + AV_RN32(ref)) >> 1) & 0x7F7F7F7FUL)
|
||||
|
||||
#define AVG_64(dst, src, ref) \
|
||||
AV_WN64A(dst, ((AV_RN64A(src) + AV_RN64A(ref)) >> 1) & 0x7F7F7F7F7F7F7F7FULL)
|
||||
AV_WN64A(dst, ((AV_RN64(src) + AV_RN64(ref)) >> 1) & 0x7F7F7F7F7F7F7F7FULL)
|
||||
|
||||
|
||||
/*
|
||||
@@ -333,7 +345,7 @@ if (*data_ptr >= last_ptr) \
|
||||
copy_block4(dst, ref, row_offset, row_offset, 4 << v_zoom)
|
||||
|
||||
#define RLE_BLOCK_COPY_8 \
|
||||
pix64 = AV_RN64A(ref);\
|
||||
pix64 = AV_RN64(ref);\
|
||||
if (is_first_row) {/* special prediction case: top line of a cell */\
|
||||
pix64 = replicate64(pix64);\
|
||||
fill_64(dst + row_offset, pix64, 7, row_offset);\
|
||||
@@ -345,7 +357,7 @@ if (*data_ptr >= last_ptr) \
|
||||
copy_block4(dst, ref, row_offset, row_offset, num_lines << v_zoom)
|
||||
|
||||
#define RLE_LINES_COPY_M10 \
|
||||
pix64 = AV_RN64A(ref);\
|
||||
pix64 = AV_RN64(ref);\
|
||||
if (is_top_of_cell) {\
|
||||
pix64 = replicate64(pix64);\
|
||||
fill_64(dst + row_offset, pix64, (num_lines << 1) - 1, row_offset);\
|
||||
@@ -355,12 +367,12 @@ if (*data_ptr >= last_ptr) \
|
||||
|
||||
#define APPLY_DELTA_4 \
|
||||
AV_WN16A(dst + line_offset ,\
|
||||
(AV_RN16A(ref ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
|
||||
(AV_RN16(ref ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
|
||||
AV_WN16A(dst + line_offset + 2,\
|
||||
(AV_RN16A(ref + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
|
||||
(AV_RN16(ref + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
|
||||
if (mode >= 3) {\
|
||||
if (is_top_of_cell && !cell->ypos) {\
|
||||
AV_COPY32(dst, dst + row_offset);\
|
||||
AV_COPY32U(dst, dst + row_offset);\
|
||||
} else {\
|
||||
AVG_32(dst, ref, dst + row_offset);\
|
||||
}\
|
||||
@@ -370,20 +382,20 @@ if (*data_ptr >= last_ptr) \
|
||||
/* apply two 32-bit VQ deltas to next even line */\
|
||||
if (is_top_of_cell) { \
|
||||
AV_WN32A(dst + row_offset , \
|
||||
(replicate32(AV_RN32A(ref )) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
(replicate32(AV_RN32(ref )) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
AV_WN32A(dst + row_offset + 4, \
|
||||
(replicate32(AV_RN32A(ref + 4)) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
(replicate32(AV_RN32(ref + 4)) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
} else { \
|
||||
AV_WN32A(dst + row_offset , \
|
||||
(AV_RN32A(ref ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
(AV_RN32(ref ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
AV_WN32A(dst + row_offset + 4, \
|
||||
(AV_RN32A(ref + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
(AV_RN32(ref + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
} \
|
||||
/* odd lines are not coded but rather interpolated/replicated */\
|
||||
/* first line of the cell on the top of image? - replicate */\
|
||||
/* otherwise - interpolate */\
|
||||
if (is_top_of_cell && !cell->ypos) {\
|
||||
AV_COPY64(dst, dst + row_offset);\
|
||||
AV_COPY64U(dst, dst + row_offset);\
|
||||
} else \
|
||||
AVG_64(dst, ref, dst + row_offset);
|
||||
|
||||
@@ -391,22 +403,22 @@ if (*data_ptr >= last_ptr) \
|
||||
#define APPLY_DELTA_1011_INTER \
|
||||
if (mode == 10) { \
|
||||
AV_WN32A(dst , \
|
||||
(AV_RN32A(dst ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
(AV_RN32(dst ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
AV_WN32A(dst + 4 , \
|
||||
(AV_RN32A(dst + 4 ) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
(AV_RN32(dst + 4 ) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
AV_WN32A(dst + row_offset , \
|
||||
(AV_RN32A(dst + row_offset ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
(AV_RN32(dst + row_offset ) + delta_tab->deltas_m10[dyad1]) & 0x7F7F7F7F);\
|
||||
AV_WN32A(dst + row_offset + 4, \
|
||||
(AV_RN32A(dst + row_offset + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
(AV_RN32(dst + row_offset + 4) + delta_tab->deltas_m10[dyad2]) & 0x7F7F7F7F);\
|
||||
} else { \
|
||||
AV_WN16A(dst , \
|
||||
(AV_RN16A(dst ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
|
||||
(AV_RN16(dst ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
|
||||
AV_WN16A(dst + 2 , \
|
||||
(AV_RN16A(dst + 2 ) + delta_tab->deltas[dyad2]) & 0x7F7F);\
|
||||
(AV_RN16(dst + 2 ) + delta_tab->deltas[dyad2]) & 0x7F7F);\
|
||||
AV_WN16A(dst + row_offset , \
|
||||
(AV_RN16A(dst + row_offset ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
|
||||
(AV_RN16(dst + row_offset ) + delta_tab->deltas[dyad1]) & 0x7F7F);\
|
||||
AV_WN16A(dst + row_offset + 2, \
|
||||
(AV_RN16A(dst + row_offset + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
|
||||
(AV_RN16(dst + row_offset + 2) + delta_tab->deltas[dyad2]) & 0x7F7F);\
|
||||
}
|
||||
|
||||
|
||||
@@ -604,11 +616,23 @@ static int decode_cell(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
} else if (mode >= 10) {
|
||||
/* for mode 10 and 11 INTER first copy the predicted cell into the current one */
|
||||
/* so we don't need to do data copying for each RLE code later */
|
||||
copy_cell(ctx, plane, cell);
|
||||
int ret = copy_cell(ctx, plane, cell);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
/* set the pointer to the reference pixels for modes 0-4 INTER */
|
||||
mv_y = cell->mv_ptr[0];
|
||||
mv_x = cell->mv_ptr[1];
|
||||
|
||||
/* -1 because there is an extra line on top for prediction */
|
||||
if ((cell->ypos << 2) + mv_y < -1 || (cell->xpos << 2) + mv_x < 0 ||
|
||||
((cell->ypos + cell->height) << 2) + mv_y > plane->height ||
|
||||
((cell->xpos + cell->width) << 2) + mv_x > plane->width) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"Motion vectors point out of the frame.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
offset += mv_y * plane->pitch + mv_x;
|
||||
ref_block = plane->pixels[ctx->buf_sel ^ 1] + offset;
|
||||
}
|
||||
@@ -740,8 +764,7 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
const int depth, const int strip_width)
|
||||
{
|
||||
Cell curr_cell;
|
||||
int bytes_used;
|
||||
int mv_x, mv_y;
|
||||
int bytes_used, ret;
|
||||
|
||||
if (depth <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Stack overflow (corrupted binary tree)!\n");
|
||||
@@ -792,19 +815,8 @@ static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
CHECK_CELL
|
||||
if (!curr_cell.mv_ptr)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
mv_y = curr_cell.mv_ptr[0];
|
||||
mv_x = curr_cell.mv_ptr[1];
|
||||
if ( mv_x + 4*curr_cell.xpos < 0
|
||||
|| mv_y + 4*curr_cell.ypos < 0
|
||||
|| mv_x + 4*curr_cell.xpos + 4*curr_cell.width > plane->width
|
||||
|| mv_y + 4*curr_cell.ypos + 4*curr_cell.height > plane->height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "motion vector %d %d outside reference\n", mv_x + 4*curr_cell.xpos, mv_y + 4*curr_cell.ypos);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
copy_cell(ctx, plane, &curr_cell);
|
||||
return 0;
|
||||
ret = copy_cell(ctx, plane, &curr_cell);
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case INTER_DATA:
|
||||
@@ -891,17 +903,20 @@ static int decode_plane(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
const uint8_t *buf_ptr = buf, *bs_hdr;
|
||||
GetByteContext gb;
|
||||
const uint8_t *bs_hdr;
|
||||
uint32_t frame_num, word2, check_sum, data_size;
|
||||
uint32_t y_offset, u_offset, v_offset, starts[3], ends[3];
|
||||
uint16_t height, width;
|
||||
int i, j;
|
||||
|
||||
bytestream2_init(&gb, buf, buf_size);
|
||||
|
||||
/* parse and check the OS header */
|
||||
frame_num = bytestream_get_le32(&buf_ptr);
|
||||
word2 = bytestream_get_le32(&buf_ptr);
|
||||
check_sum = bytestream_get_le32(&buf_ptr);
|
||||
data_size = bytestream_get_le32(&buf_ptr);
|
||||
frame_num = bytestream2_get_le32(&gb);
|
||||
word2 = bytestream2_get_le32(&gb);
|
||||
check_sum = bytestream2_get_le32(&gb);
|
||||
data_size = bytestream2_get_le32(&gb);
|
||||
|
||||
if ((frame_num ^ word2 ^ data_size ^ OS_HDR_ID) != check_sum) {
|
||||
av_log(avctx, AV_LOG_ERROR, "OS header checksum mismatch!\n");
|
||||
@@ -909,29 +924,27 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
/* parse the bitstream header */
|
||||
bs_hdr = buf_ptr;
|
||||
buf_size -= 16;
|
||||
bs_hdr = gb.buffer;
|
||||
|
||||
if (bytestream_get_le16(&buf_ptr) != 32) {
|
||||
if (bytestream2_get_le16(&gb) != 32) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Unsupported codec version!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->frame_num = frame_num;
|
||||
ctx->frame_flags = bytestream_get_le16(&buf_ptr);
|
||||
ctx->data_size = (bytestream_get_le32(&buf_ptr) + 7) >> 3;
|
||||
ctx->cb_offset = *buf_ptr++;
|
||||
ctx->frame_flags = bytestream2_get_le16(&gb);
|
||||
ctx->data_size = (bytestream2_get_le32(&gb) + 7) >> 3;
|
||||
ctx->cb_offset = bytestream2_get_byte(&gb);
|
||||
|
||||
if (ctx->data_size == 16)
|
||||
return 4;
|
||||
if (ctx->data_size > buf_size)
|
||||
ctx->data_size = buf_size;
|
||||
ctx->data_size = FFMIN(ctx->data_size, buf_size - 16);
|
||||
|
||||
buf_ptr += 3; // skip reserved byte and checksum
|
||||
bytestream2_skip(&gb, 3); // skip reserved byte and checksum
|
||||
|
||||
/* check frame dimensions */
|
||||
height = bytestream_get_le16(&buf_ptr);
|
||||
width = bytestream_get_le16(&buf_ptr);
|
||||
height = bytestream2_get_le16(&gb);
|
||||
width = bytestream2_get_le16(&gb);
|
||||
if (av_image_check_size(width, height, 0, avctx))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -953,9 +966,10 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
avcodec_set_dimensions(avctx, width, height);
|
||||
}
|
||||
|
||||
y_offset = bytestream_get_le32(&buf_ptr);
|
||||
v_offset = bytestream_get_le32(&buf_ptr);
|
||||
u_offset = bytestream_get_le32(&buf_ptr);
|
||||
y_offset = bytestream2_get_le32(&gb);
|
||||
v_offset = bytestream2_get_le32(&gb);
|
||||
u_offset = bytestream2_get_le32(&gb);
|
||||
bytestream2_skip(&gb, 4);
|
||||
|
||||
/* unfortunately there is no common order of planes in the buffer */
|
||||
/* so we use that sorting algo for determining planes data sizes */
|
||||
@@ -974,6 +988,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
ctx->v_data_size = ends[1] - starts[1];
|
||||
ctx->u_data_size = ends[2] - starts[2];
|
||||
if (FFMAX3(y_offset, v_offset, u_offset) >= ctx->data_size - 16 ||
|
||||
FFMIN3(y_offset, v_offset, u_offset) < gb.buffer - bs_hdr + 16 ||
|
||||
FFMIN3(ctx->y_data_size, ctx->v_data_size, ctx->u_data_size) <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "One of the y/u/v offsets is invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -982,7 +997,7 @@ static int decode_frame_headers(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
|
||||
ctx->y_data_ptr = bs_hdr + y_offset;
|
||||
ctx->v_data_ptr = bs_hdr + v_offset;
|
||||
ctx->u_data_ptr = bs_hdr + u_offset;
|
||||
ctx->alt_quant = buf_ptr + sizeof(uint32_t);
|
||||
ctx->alt_quant = gb.buffer;
|
||||
|
||||
if (ctx->data_size == 16) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "Sync frame encountered!\n");
|
||||
|
@@ -211,6 +211,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) {
|
||||
if (ff_ivi_init_planes(ctx->planes, &pic_conf)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n");
|
||||
ctx->pic_conf.luma_bands = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
@@ -353,7 +354,13 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
band->inv_transform = transforms[transform_id].inv_trans;
|
||||
band->dc_transform = transforms[transform_id].dc_trans;
|
||||
band->is_2d_trans = transforms[transform_id].is_2d_trans;
|
||||
band->transform_size= (transform_id < 10) ? 8 : 4;
|
||||
if (transform_id < 10)
|
||||
band->transform_size = 8;
|
||||
else
|
||||
band->transform_size = 4;
|
||||
|
||||
if (band->blk_size != band->transform_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
scan_indx = get_bits(&ctx->gb, 4);
|
||||
if ((scan_indx>4 && scan_indx<10) != (band->blk_size==4)) {
|
||||
@@ -364,6 +371,12 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
av_log(avctx, AV_LOG_ERROR, "Custom scan pattern encountered!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (scan_indx > 4 && scan_indx < 10) {
|
||||
if (band->blk_size != 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else if (band->blk_size != 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
band->scan = scan_index_to_tab[scan_indx];
|
||||
band->scan_size = band->blk_size;
|
||||
|
||||
@@ -372,8 +385,9 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
av_log(avctx, AV_LOG_ERROR, "Custom quant matrix encountered!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (quant_mat > 21) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid quant matrix encountered!\n");
|
||||
if (quant_mat >= FF_ARRAY_ELEMS(quant_index_to_tab)) {
|
||||
av_log_ask_for_sample(avctx, "Quantization matrix %d",
|
||||
quant_mat);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
band->quant_mat = quant_mat;
|
||||
@@ -504,8 +518,11 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (band->inherit_mv && ref_mb) {
|
||||
mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */
|
||||
if (band->inherit_mv) {
|
||||
/* copy mb_type from corresponding reference mb */
|
||||
if (!ref_mb)
|
||||
return AVERROR_INVALIDDATA;
|
||||
mb->type = ref_mb->type;
|
||||
} else if (ctx->frame_type == FRAMETYPE_INTRA ||
|
||||
ctx->frame_type == FRAMETYPE_INTRA1) {
|
||||
mb->type = 0; /* mb_type is always INTRA for intra-frames */
|
||||
@@ -528,15 +545,16 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
if (!mb->type) {
|
||||
mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */
|
||||
} else {
|
||||
if (band->inherit_mv && ref_mb) {
|
||||
/* motion vector inheritance */
|
||||
if (mv_scale) {
|
||||
mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
|
||||
mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
|
||||
} else {
|
||||
mb->mv_x = ref_mb->mv_x;
|
||||
mb->mv_y = ref_mb->mv_y;
|
||||
}
|
||||
if (band->inherit_mv) {
|
||||
if (ref_mb)
|
||||
/* motion vector inheritance */
|
||||
if (mv_scale) {
|
||||
mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
|
||||
mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
|
||||
} else {
|
||||
mb->mv_x = ref_mb->mv_x;
|
||||
mb->mv_y = ref_mb->mv_y;
|
||||
}
|
||||
} else {
|
||||
/* decode motion vector deltas */
|
||||
mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table,
|
||||
|
@@ -74,7 +74,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
tile_size = (ctx->gop_flags & 0x40) ? 64 << get_bits(&ctx->gb, 2) : 0;
|
||||
if (tile_size > 256) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid tile size: %d\n", tile_size);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* decode number of wavelet bands */
|
||||
@@ -85,7 +85,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
if (is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
|
||||
pic_conf.luma_bands, pic_conf.chroma_bands);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
pic_size_indx = get_bits(&ctx->gb, 4);
|
||||
@@ -98,8 +98,8 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
if (ctx->gop_flags & 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "YV12 picture format not supported!\n");
|
||||
return -1;
|
||||
av_log_missing_feature(avctx, "YV12 picture format", 0);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;
|
||||
@@ -113,11 +113,11 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
/* check if picture layout was changed and reallocate buffers */
|
||||
if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) {
|
||||
if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf) || ctx->gop_invalid) {
|
||||
result = ff_ivi_init_planes(ctx->planes, &pic_conf);
|
||||
if (result) {
|
||||
if (result < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n");
|
||||
return -1;
|
||||
return result;
|
||||
}
|
||||
ctx->pic_conf = pic_conf;
|
||||
ctx->is_scalable = is_scalable;
|
||||
@@ -146,51 +146,54 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
if (get_bits1(&ctx->gb)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Extended transform info encountered!\n");
|
||||
return -1;
|
||||
av_log_missing_feature(avctx, "Extended transform info", 0);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
/* select transform function and scan pattern according to plane and band number */
|
||||
switch ((p << 2) + i) {
|
||||
case 0:
|
||||
band->inv_transform = ff_ivi_inverse_slant_8x8;
|
||||
band->dc_transform = ff_ivi_dc_slant_2d;
|
||||
band->scan = ff_zigzag_direct;
|
||||
band->transform_size= 8;
|
||||
band->inv_transform = ff_ivi_inverse_slant_8x8;
|
||||
band->dc_transform = ff_ivi_dc_slant_2d;
|
||||
band->scan = ff_zigzag_direct;
|
||||
band->transform_size = 8;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
band->inv_transform = ff_ivi_row_slant8;
|
||||
band->dc_transform = ff_ivi_dc_row_slant;
|
||||
band->scan = ff_ivi_vertical_scan_8x8;
|
||||
band->transform_size= 8;
|
||||
band->inv_transform = ff_ivi_row_slant8;
|
||||
band->dc_transform = ff_ivi_dc_row_slant;
|
||||
band->scan = ff_ivi_vertical_scan_8x8;
|
||||
band->transform_size = 8;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
band->inv_transform = ff_ivi_col_slant8;
|
||||
band->dc_transform = ff_ivi_dc_col_slant;
|
||||
band->scan = ff_ivi_horizontal_scan_8x8;
|
||||
band->transform_size= 8;
|
||||
band->inv_transform = ff_ivi_col_slant8;
|
||||
band->dc_transform = ff_ivi_dc_col_slant;
|
||||
band->scan = ff_ivi_horizontal_scan_8x8;
|
||||
band->transform_size = 8;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
band->inv_transform = ff_ivi_put_pixels_8x8;
|
||||
band->dc_transform = ff_ivi_put_dc_pixel_8x8;
|
||||
band->scan = ff_ivi_horizontal_scan_8x8;
|
||||
band->transform_size= 8;
|
||||
band->inv_transform = ff_ivi_put_pixels_8x8;
|
||||
band->dc_transform = ff_ivi_put_dc_pixel_8x8;
|
||||
band->scan = ff_ivi_horizontal_scan_8x8;
|
||||
band->transform_size = 8;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
band->inv_transform = ff_ivi_inverse_slant_4x4;
|
||||
band->dc_transform = ff_ivi_dc_slant_2d;
|
||||
band->scan = ff_ivi_direct_scan_4x4;
|
||||
band->transform_size= 4;
|
||||
band->inv_transform = ff_ivi_inverse_slant_4x4;
|
||||
band->dc_transform = ff_ivi_dc_slant_2d;
|
||||
band->scan = ff_ivi_direct_scan_4x4;
|
||||
band->transform_size = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 ||
|
||||
band->inv_transform == ff_ivi_inverse_slant_4x4;
|
||||
|
||||
if (band->transform_size != band->blk_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* select dequant matrix according to plane and band number */
|
||||
if (!p) {
|
||||
quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0;
|
||||
@@ -216,7 +219,7 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
|
||||
if (get_bits(&ctx->gb, 2)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "End marker missing!\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,17 +249,17 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
if (blk_size_changed) {
|
||||
result = ff_ivi_init_tiles(ctx->planes, pic_conf.tile_width,
|
||||
pic_conf.tile_height);
|
||||
if (result) {
|
||||
if (result < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Couldn't reallocate internal structures!\n");
|
||||
return -1;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->gop_flags & 8) {
|
||||
if (get_bits(&ctx->gb, 3)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Alignment bits are not zero!\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (get_bits1(&ctx->gb))
|
||||
@@ -305,25 +308,27 @@ static inline void skip_hdr_extension(GetBitContext *gb)
|
||||
*/
|
||||
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (get_bits(&ctx->gb, 5) != 0x1F) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid picture start code!\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->prev_frame_type = ctx->frame_type;
|
||||
ctx->frame_type = get_bits(&ctx->gb, 3);
|
||||
if (ctx->frame_type >= 5) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid frame type: %d \n", ctx->frame_type);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->frame_num = get_bits(&ctx->gb, 8);
|
||||
|
||||
if (ctx->frame_type == FRAMETYPE_INTRA) {
|
||||
ctx->gop_invalid = 1;
|
||||
if (decode_gop_header(ctx, avctx)) {
|
||||
if ((ret = decode_gop_header(ctx, avctx)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid GOP header, skipping frames.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
ctx->gop_invalid = 1;
|
||||
return ret;
|
||||
}
|
||||
ctx->gop_invalid = 0;
|
||||
}
|
||||
@@ -346,8 +351,10 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
skip_hdr_extension(&ctx->gb); /* XXX: untested */
|
||||
|
||||
/* decode macroblock huffman codebook */
|
||||
if (ff_ivi_dec_huff_desc(&ctx->gb, ctx->frame_flags & 0x40, IVI_MB_HUFF, &ctx->mb_vlc, avctx))
|
||||
return -1;
|
||||
ret = ff_ivi_dec_huff_desc(&ctx->gb, ctx->frame_flags & 0x40,
|
||||
IVI_MB_HUFF, &ctx->mb_vlc, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
skip_bits(&ctx->gb, 3); /* FIXME: unknown meaning! */
|
||||
}
|
||||
@@ -369,7 +376,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
|
||||
static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
AVCodecContext *avctx)
|
||||
{
|
||||
int i;
|
||||
int i, ret;
|
||||
uint8_t band_flags;
|
||||
|
||||
band_flags = get_bits(&ctx->gb, 8);
|
||||
@@ -393,7 +400,7 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
if (band->num_corr > 61) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many corrections: %d\n",
|
||||
band->num_corr);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* read correction pairs */
|
||||
@@ -405,8 +412,10 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
band->rvmap_sel = (band_flags & 0x40) ? get_bits(&ctx->gb, 3) : 8;
|
||||
|
||||
/* decode block huffman codebook */
|
||||
if (ff_ivi_dec_huff_desc(&ctx->gb, band_flags & 0x80, IVI_BLK_HUFF, &band->blk_vlc, avctx))
|
||||
return -1;
|
||||
ret = ff_ivi_dec_huff_desc(&ctx->gb, band_flags & 0x80, IVI_BLK_HUFF,
|
||||
&band->blk_vlc, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
band->checksum_present = get_bits1(&ctx->gb);
|
||||
if (band->checksum_present)
|
||||
@@ -473,7 +482,7 @@ static int decode_mb_info(IVI45DecContext *ctx, IVIBandDesc *band,
|
||||
if (get_bits1(&ctx->gb)) {
|
||||
if (ctx->frame_type == FRAMETYPE_INTRA) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mb->type = 1; /* empty macroblocks are always INTER */
|
||||
mb->cbp = 0; /* all blocks are empty */
|
||||
@@ -648,7 +657,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
result = ff_ivi_init_planes(ctx->planes, &ctx->pic_conf);
|
||||
if (result) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Couldn't allocate color planes!\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->buf_switch = 0;
|
||||
|
@@ -41,6 +41,29 @@ extern const IVIHuffDesc ff_ivi_blk_huff_desc[8]; ///< static block huffman tabl
|
||||
static VLC ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables
|
||||
static VLC ivi_blk_vlc_tabs[8]; ///< static block Huffman tables
|
||||
|
||||
typedef void (*ivi_mc_func) (int16_t *buf, const int16_t *ref_buf,
|
||||
uint32_t pitch, int mc_type);
|
||||
|
||||
static int ivi_mc(IVIBandDesc *band, ivi_mc_func mc,
|
||||
int offs, int mv_x, int mv_y, int mc_type)
|
||||
{
|
||||
int ref_offs = offs + mv_y * band->pitch + mv_x;
|
||||
int buf_size = band->pitch * band->aheight;
|
||||
int min_size = band->pitch * (band->blk_size - 1) + band->blk_size;
|
||||
int ref_size = (mc_type > 1) * band->pitch + (mc_type & 1);
|
||||
|
||||
if (offs < 0 || ref_offs < 0 || !band->ref_buf)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (buf_size - min_size < offs)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (buf_size - min_size - ref_size < ref_offs)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
mc(band->buf + offs, band->ref_buf + ref_offs, band->pitch, mc_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse "nbits" bits of the value "val" and return the result
|
||||
* in the least significant bits.
|
||||
@@ -50,9 +73,10 @@ static uint16_t inv_bits(uint16_t val, int nbits)
|
||||
uint16_t res;
|
||||
|
||||
if (nbits <= 8) {
|
||||
res = ff_reverse[val] >> (8-nbits);
|
||||
res = ff_reverse[val] >> (8 - nbits);
|
||||
} else
|
||||
res = ((ff_reverse[val & 0xFF] << 8) + (ff_reverse[val >> 8])) >> (16-nbits);
|
||||
res = ((ff_reverse[val & 0xFF] << 8) +
|
||||
(ff_reverse[val >> 8])) >> (16 - nbits);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -85,7 +109,7 @@ static int ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag)
|
||||
|
||||
bits[pos] = i + cb->xbits[i] + not_last_row;
|
||||
if (bits[pos] > IVI_VLC_BITS)
|
||||
return -1; /* invalid descriptor */
|
||||
return AVERROR_INVALIDDATA; /* invalid descriptor */
|
||||
|
||||
codewords[pos] = inv_bits((prefix | j), bits[pos]);
|
||||
if (!bits[pos])
|
||||
@@ -111,10 +135,12 @@ void ff_ivi_init_static_vlc(void)
|
||||
for (i = 0; i < 8; i++) {
|
||||
ivi_mb_vlc_tabs[i].table = table_data + i * 2 * 8192;
|
||||
ivi_mb_vlc_tabs[i].table_allocated = 8192;
|
||||
ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i], &ivi_mb_vlc_tabs[i], 1);
|
||||
ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i],
|
||||
&ivi_mb_vlc_tabs[i], 1);
|
||||
ivi_blk_vlc_tabs[i].table = table_data + (i * 2 + 1) * 8192;
|
||||
ivi_blk_vlc_tabs[i].table_allocated = 8192;
|
||||
ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i], &ivi_blk_vlc_tabs[i], 1);
|
||||
ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i],
|
||||
&ivi_blk_vlc_tabs[i], 1);
|
||||
}
|
||||
initialized_vlcs = 1;
|
||||
}
|
||||
@@ -138,56 +164,59 @@ static void ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src)
|
||||
* @param[in] desc2 ptr to the 2nd descriptor to compare
|
||||
* @return comparison result: 0 - equal, 1 - not equal
|
||||
*/
|
||||
static int ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2)
|
||||
static int ivi_huff_desc_cmp(const IVIHuffDesc *desc1,
|
||||
const IVIHuffDesc *desc2)
|
||||
{
|
||||
return desc1->num_rows != desc2->num_rows
|
||||
|| memcmp(desc1->xbits, desc2->xbits, desc1->num_rows);
|
||||
return desc1->num_rows != desc2->num_rows ||
|
||||
memcmp(desc1->xbits, desc2->xbits, desc1->num_rows);
|
||||
}
|
||||
|
||||
int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
|
||||
IVIHuffTab *huff_tab, AVCodecContext *avctx)
|
||||
{
|
||||
int i, result;
|
||||
int i, result;
|
||||
IVIHuffDesc new_huff;
|
||||
|
||||
if (!desc_coded) {
|
||||
/* select default table */
|
||||
huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[7]
|
||||
: &ivi_mb_vlc_tabs [7];
|
||||
} else {
|
||||
huff_tab->tab_sel = get_bits(gb, 3);
|
||||
if (huff_tab->tab_sel == 7) {
|
||||
/* custom huffman table (explicitly encoded) */
|
||||
new_huff.num_rows = get_bits(gb, 4);
|
||||
if (!new_huff.num_rows) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Empty custom Huffman table!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
: &ivi_mb_vlc_tabs [7];
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < new_huff.num_rows; i++)
|
||||
new_huff.xbits[i] = get_bits(gb, 4);
|
||||
|
||||
/* Have we got the same custom table? Rebuild if not. */
|
||||
if (ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc) || !huff_tab->cust_tab.table) {
|
||||
ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
|
||||
|
||||
if (huff_tab->cust_tab.table)
|
||||
ff_free_vlc(&huff_tab->cust_tab);
|
||||
result = ivi_create_huff_from_desc(&huff_tab->cust_desc,
|
||||
&huff_tab->cust_tab, 0);
|
||||
if (result) {
|
||||
huff_tab->cust_desc.num_rows = 0; // reset faulty description
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error while initializing custom vlc table!\n");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
huff_tab->tab = &huff_tab->cust_tab;
|
||||
} else {
|
||||
/* select one of predefined tables */
|
||||
huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[huff_tab->tab_sel]
|
||||
: &ivi_mb_vlc_tabs [huff_tab->tab_sel];
|
||||
huff_tab->tab_sel = get_bits(gb, 3);
|
||||
if (huff_tab->tab_sel == 7) {
|
||||
/* custom huffman table (explicitly encoded) */
|
||||
new_huff.num_rows = get_bits(gb, 4);
|
||||
if (!new_huff.num_rows) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Empty custom Huffman table!\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
for (i = 0; i < new_huff.num_rows; i++)
|
||||
new_huff.xbits[i] = get_bits(gb, 4);
|
||||
|
||||
/* Have we got the same custom table? Rebuild if not. */
|
||||
if (ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc) || !huff_tab->cust_tab.table) {
|
||||
ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
|
||||
|
||||
if (huff_tab->cust_tab.table)
|
||||
ff_free_vlc(&huff_tab->cust_tab);
|
||||
result = ivi_create_huff_from_desc(&huff_tab->cust_desc,
|
||||
&huff_tab->cust_tab, 0);
|
||||
if (result) {
|
||||
// reset faulty description
|
||||
huff_tab->cust_desc.num_rows = 0;
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error while initializing custom vlc table!\n");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
huff_tab->tab = &huff_tab->cust_tab;
|
||||
} else {
|
||||
/* select one of predefined tables */
|
||||
huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[huff_tab->tab_sel]
|
||||
: &ivi_mb_vlc_tabs [huff_tab->tab_sel];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -216,17 +245,23 @@ static av_cold void ivi_free_buffers(IVIPlaneDesc *planes)
|
||||
av_freep(&planes[p].bands[b].tiles);
|
||||
}
|
||||
av_freep(&planes[p].bands);
|
||||
planes[p].num_bands = 0;
|
||||
}
|
||||
}
|
||||
|
||||
av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
|
||||
{
|
||||
int p, b;
|
||||
uint32_t b_width, b_height, align_fac, width_aligned, height_aligned, buf_size;
|
||||
int p, b;
|
||||
uint32_t b_width, b_height, align_fac, width_aligned,
|
||||
height_aligned, buf_size;
|
||||
IVIBandDesc *band;
|
||||
|
||||
ivi_free_buffers(planes);
|
||||
|
||||
if (cfg->pic_width < 1 || cfg->pic_height < 1 ||
|
||||
cfg->luma_bands < 1 || cfg->chroma_bands < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* fill in the descriptor of the luminance plane */
|
||||
planes[0].width = cfg->pic_width;
|
||||
planes[0].height = cfg->pic_height;
|
||||
@@ -245,8 +280,10 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
|
||||
/* select band dimensions: if there is only one band then it
|
||||
* has the full size, if there are several bands each of them
|
||||
* has only half size */
|
||||
b_width = planes[p].num_bands == 1 ? planes[p].width : (planes[p].width + 1) >> 1;
|
||||
b_height = planes[p].num_bands == 1 ? planes[p].height : (planes[p].height + 1) >> 1;
|
||||
b_width = planes[p].num_bands == 1 ? planes[p].width
|
||||
: (planes[p].width + 1) >> 1;
|
||||
b_height = planes[p].num_bands == 1 ? planes[p].height
|
||||
: (planes[p].height + 1) >> 1;
|
||||
|
||||
/* luma band buffers will be aligned on 16x16 (max macroblock size) */
|
||||
/* chroma band buffers will be aligned on 8x8 (max macroblock size) */
|
||||
@@ -275,19 +312,56 @@ av_cold int ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
|
||||
if (!band->bufs[2])
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0; /* reset custom vlc */
|
||||
/* reset custom vlc */
|
||||
planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
|
||||
static int ivi_init_tiles(IVIBandDesc *band, IVITile *ref_tile,
|
||||
int p, int b, int t_height, int t_width)
|
||||
{
|
||||
int p, b, x, y, x_tiles, y_tiles, t_width, t_height;
|
||||
int x, y;
|
||||
IVITile *tile = band->tiles;
|
||||
|
||||
for (y = 0; y < band->height; y += t_height) {
|
||||
for (x = 0; x < band->width; x += t_width) {
|
||||
tile->xpos = x;
|
||||
tile->ypos = y;
|
||||
tile->mb_size = band->mb_size;
|
||||
tile->width = FFMIN(band->width - x, t_width);
|
||||
tile->height = FFMIN(band->height - y, t_height);
|
||||
tile->is_empty = tile->data_size = 0;
|
||||
/* calculate number of macroblocks */
|
||||
tile->num_MBs = IVI_MBs_PER_TILE(tile->width, tile->height,
|
||||
band->mb_size);
|
||||
|
||||
av_freep(&tile->mbs);
|
||||
tile->mbs = av_malloc(tile->num_MBs * sizeof(IVIMbInfo));
|
||||
if (!tile->mbs)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
tile->ref_mbs = 0;
|
||||
if (p || b) {
|
||||
if (tile->num_MBs != ref_tile->num_MBs)
|
||||
return AVERROR_INVALIDDATA;
|
||||
tile->ref_mbs = ref_tile->mbs;
|
||||
ref_tile++;
|
||||
}
|
||||
tile++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes,
|
||||
int tile_width, int tile_height)
|
||||
{
|
||||
int p, b, x_tiles, y_tiles, t_width, t_height, ret;
|
||||
IVIBandDesc *band;
|
||||
IVITile *tile, *ref_tile;
|
||||
|
||||
for (p = 0; p < 3; p++) {
|
||||
t_width = !p ? tile_width : (tile_width + 3) >> 2;
|
||||
@@ -311,44 +385,14 @@ av_cold int ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_hei
|
||||
if (!band->tiles)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
tile = band->tiles;
|
||||
|
||||
/* use the first luma band as reference for motion vectors
|
||||
* and quant */
|
||||
ref_tile = planes[0].bands[0].tiles;
|
||||
|
||||
for (y = 0; y < band->height; y += t_height) {
|
||||
for (x = 0; x < band->width; x += t_width) {
|
||||
tile->xpos = x;
|
||||
tile->ypos = y;
|
||||
tile->mb_size = band->mb_size;
|
||||
tile->width = FFMIN(band->width - x, t_width);
|
||||
tile->height = FFMIN(band->height - y, t_height);
|
||||
tile->is_empty = tile->data_size = 0;
|
||||
/* calculate number of macroblocks */
|
||||
tile->num_MBs = IVI_MBs_PER_TILE(tile->width, tile->height,
|
||||
band->mb_size);
|
||||
|
||||
av_freep(&tile->mbs);
|
||||
tile->mbs = av_malloc(tile->num_MBs * sizeof(IVIMbInfo));
|
||||
if (!tile->mbs)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
tile->ref_mbs = 0;
|
||||
if (p || b) {
|
||||
if (tile->num_MBs <= ref_tile->num_MBs) {
|
||||
tile->ref_mbs = ref_tile->mbs;
|
||||
}else
|
||||
av_log(NULL, AV_LOG_DEBUG, "Cannot use ref_tile, too few mbs\n");
|
||||
ref_tile++;
|
||||
}
|
||||
|
||||
tile++;
|
||||
}
|
||||
}
|
||||
|
||||
}// for b
|
||||
}// for p
|
||||
ret = ivi_init_tiles(band, planes[0].bands[0].tiles,
|
||||
p, b, t_height, t_width);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -380,6 +424,117 @@ static int ivi_dec_tile_data_size(GetBitContext *gb)
|
||||
return len;
|
||||
}
|
||||
|
||||
static int ivi_dc_transform(IVIBandDesc *band, int *prev_dc, int buf_offs,
|
||||
int blk_size)
|
||||
{
|
||||
int buf_size = band->pitch * band->aheight - buf_offs;
|
||||
int min_size = (blk_size - 1) * band->pitch + blk_size;
|
||||
|
||||
if (min_size > buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
band->dc_transform(prev_dc, band->buf + buf_offs,
|
||||
band->pitch, blk_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ivi_decode_coded_blocks(GetBitContext *gb, IVIBandDesc *band,
|
||||
ivi_mc_func mc, int mv_x, int mv_y,
|
||||
int *prev_dc, int is_intra, int mc_type,
|
||||
uint32_t quant, int offs,
|
||||
AVCodecContext *avctx)
|
||||
{
|
||||
const uint16_t *base_tab = is_intra ? band->intra_base : band->inter_base;
|
||||
RVMapDesc *rvmap = band->rv_map;
|
||||
uint8_t col_flags[8];
|
||||
int32_t trvec[64];
|
||||
uint32_t sym = 0, lo, hi, q;
|
||||
int pos, run, val;
|
||||
int blk_size = band->blk_size;
|
||||
int num_coeffs = blk_size * blk_size;
|
||||
int col_mask = blk_size - 1;
|
||||
int scan_pos = -1;
|
||||
int min_size = band->pitch * (band->transform_size - 1) +
|
||||
band->transform_size;
|
||||
int buf_size = band->pitch * band->aheight - offs;
|
||||
|
||||
if (min_size > buf_size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (!band->scan) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Scan pattern is not set.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* zero transform vector */
|
||||
memset(trvec, 0, num_coeffs * sizeof(trvec[0]));
|
||||
/* zero column flags */
|
||||
memset(col_flags, 0, sizeof(col_flags));
|
||||
while (scan_pos <= num_coeffs) {
|
||||
sym = get_vlc2(gb, band->blk_vlc.tab->table,
|
||||
IVI_VLC_BITS, 1);
|
||||
if (sym == rvmap->eob_sym)
|
||||
break; /* End of block */
|
||||
|
||||
/* Escape - run/val explicitly coded using 3 vlc codes */
|
||||
if (sym == rvmap->esc_sym) {
|
||||
run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;
|
||||
lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
|
||||
hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
|
||||
/* merge them and convert into signed val */
|
||||
val = IVI_TOSIGNED((hi << 6) | lo);
|
||||
} else {
|
||||
if (sym >= 256U) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
run = rvmap->runtab[sym];
|
||||
val = rvmap->valtab[sym];
|
||||
}
|
||||
|
||||
/* de-zigzag and dequantize */
|
||||
scan_pos += run;
|
||||
if (scan_pos >= num_coeffs || scan_pos < 0)
|
||||
break;
|
||||
pos = band->scan[scan_pos];
|
||||
|
||||
if (!val)
|
||||
av_dlog(avctx, "Val = 0 encountered!\n");
|
||||
|
||||
q = (base_tab[pos] * quant) >> 9;
|
||||
if (q > 1)
|
||||
val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
|
||||
trvec[pos] = val;
|
||||
/* track columns containing non-zero coeffs */
|
||||
col_flags[pos & col_mask] |= !!val;
|
||||
}
|
||||
|
||||
if (scan_pos < 0 || scan_pos >= num_coeffs && sym != rvmap->eob_sym)
|
||||
return AVERROR_INVALIDDATA; /* corrupt block data */
|
||||
|
||||
/* undoing DC coeff prediction for intra-blocks */
|
||||
if (is_intra && band->is_2d_trans) {
|
||||
*prev_dc += trvec[0];
|
||||
trvec[0] = *prev_dc;
|
||||
col_flags[0] |= !!*prev_dc;
|
||||
}
|
||||
|
||||
if(band->transform_size > band->blk_size){
|
||||
av_log(NULL, AV_LOG_ERROR, "Too large transform\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* apply inverse transform */
|
||||
band->inv_transform(trvec, band->buf + offs,
|
||||
band->pitch, col_flags);
|
||||
|
||||
/* apply motion compensation */
|
||||
if (!is_intra)
|
||||
return ivi_mc(band, mc, offs, mv_x, mv_y, mc_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Decode block data:
|
||||
* extract huffman-coded transform coefficients from the bitstream,
|
||||
@@ -391,27 +546,22 @@ static int ivi_dec_tile_data_size(GetBitContext *gb)
|
||||
* @param[in] tile pointer to the tile descriptor
|
||||
* @return result code: 0 - OK, -1 = error (corrupted blocks data)
|
||||
*/
|
||||
static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile,
|
||||
AVCodecContext *avctx)
|
||||
static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band,
|
||||
IVITile *tile, AVCodecContext *avctx)
|
||||
{
|
||||
int mbn, blk, num_blocks, num_coeffs, blk_size, scan_pos, run, val,
|
||||
pos, is_intra, mc_type = 0, av_uninit(mv_x), av_uninit(mv_y), col_mask;
|
||||
uint8_t col_flags[8];
|
||||
int32_t prev_dc, trvec[64];
|
||||
uint32_t cbp, av_uninit(sym), lo, hi, quant, buf_offs, q;
|
||||
IVIMbInfo *mb;
|
||||
RVMapDesc *rvmap = band->rv_map;
|
||||
void (*mc_with_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
|
||||
void (*mc_no_delta_func) (int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
|
||||
const uint16_t *base_tab;
|
||||
const uint8_t *scale_tab;
|
||||
|
||||
prev_dc = 0; /* init intra prediction for the DC coefficient */
|
||||
int mbn, blk, num_blocks, blk_size, ret, is_intra, mc_type = 0;
|
||||
int mv_x = 0, mv_y = 0;
|
||||
int32_t prev_dc;
|
||||
uint32_t cbp, quant, buf_offs;
|
||||
IVIMbInfo *mb;
|
||||
ivi_mc_func mc_with_delta_func, mc_no_delta_func;
|
||||
const uint8_t *scale_tab;
|
||||
|
||||
/* init intra prediction for the DC coefficient */
|
||||
prev_dc = 0;
|
||||
blk_size = band->blk_size;
|
||||
col_mask = blk_size - 1; /* column mask for tracking non-zero coeffs */
|
||||
num_blocks = (band->mb_size != blk_size) ? 4 : 1; /* number of blocks per mb */
|
||||
num_coeffs = blk_size * blk_size;
|
||||
/* number of blocks per mb */
|
||||
num_blocks = (band->mb_size != blk_size) ? 4 : 1;
|
||||
if (blk_size == 8) {
|
||||
mc_with_delta_func = ff_ivi_mc_8x8_delta;
|
||||
mc_no_delta_func = ff_ivi_mc_8x8_no_delta;
|
||||
@@ -427,7 +577,6 @@ static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile
|
||||
|
||||
quant = av_clip(band->glob_quant + mb->q_delta, 0, 23);
|
||||
|
||||
base_tab = is_intra ? band->intra_base : band->inter_base;
|
||||
scale_tab = is_intra ? band->intra_scale : band->inter_scale;
|
||||
if (scale_tab)
|
||||
quant = scale_tab[quant];
|
||||
@@ -448,10 +597,10 @@ static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile
|
||||
cx = mb->mv_x & band->is_halfpel;
|
||||
cy = mb->mv_y & band->is_halfpel;
|
||||
|
||||
if ( mb->xpos + dmv_x < 0
|
||||
|| mb->xpos + dmv_x + band->mb_size + cx > band->pitch
|
||||
|| mb->ypos + dmv_y < 0
|
||||
|| mb->ypos + dmv_y + band->mb_size + cy > band->aheight) {
|
||||
if (mb->xpos + dmv_x < 0 ||
|
||||
mb->xpos + dmv_x + band->mb_size + cx > band->pitch ||
|
||||
mb->ypos + dmv_y < 0 ||
|
||||
mb->ypos + dmv_y + band->mb_size + cy > band->aheight) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
@@ -467,83 +616,26 @@ static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile
|
||||
}
|
||||
|
||||
if (cbp & 1) { /* block coded ? */
|
||||
if (!band->scan) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Scan pattern is not set.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
scan_pos = -1;
|
||||
memset(trvec, 0, num_coeffs*sizeof(trvec[0])); /* zero transform vector */
|
||||
memset(col_flags, 0, sizeof(col_flags)); /* zero column flags */
|
||||
|
||||
while (scan_pos <= num_coeffs) {
|
||||
sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
|
||||
if (sym == rvmap->eob_sym)
|
||||
break; /* End of block */
|
||||
|
||||
if (sym == rvmap->esc_sym) { /* Escape - run/val explicitly coded using 3 vlc codes */
|
||||
run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;
|
||||
lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
|
||||
hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
|
||||
val = IVI_TOSIGNED((hi << 6) | lo); /* merge them and convert into signed val */
|
||||
} else {
|
||||
if (sym >= 256U) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym);
|
||||
return -1;
|
||||
}
|
||||
run = rvmap->runtab[sym];
|
||||
val = rvmap->valtab[sym];
|
||||
}
|
||||
|
||||
/* de-zigzag and dequantize */
|
||||
scan_pos += run;
|
||||
if (scan_pos >= (unsigned)num_coeffs)
|
||||
break;
|
||||
pos = band->scan[scan_pos];
|
||||
|
||||
if (!val)
|
||||
av_dlog(avctx, "Val = 0 encountered!\n");
|
||||
|
||||
q = (base_tab[pos] * quant) >> 9;
|
||||
if (q > 1)
|
||||
val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
|
||||
trvec[pos] = val;
|
||||
col_flags[pos & col_mask] |= !!val; /* track columns containing non-zero coeffs */
|
||||
}// while
|
||||
|
||||
if (scan_pos >= num_coeffs && sym != rvmap->eob_sym)
|
||||
return -1; /* corrupt block data */
|
||||
|
||||
/* undoing DC coeff prediction for intra-blocks */
|
||||
if (is_intra && band->is_2d_trans) {
|
||||
prev_dc += trvec[0];
|
||||
trvec[0] = prev_dc;
|
||||
col_flags[0] |= !!prev_dc;
|
||||
}
|
||||
if(band->transform_size > band->blk_size){
|
||||
av_log(NULL, AV_LOG_ERROR, "Too large transform\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
/* apply inverse transform */
|
||||
band->inv_transform(trvec, band->buf + buf_offs,
|
||||
band->pitch, col_flags);
|
||||
|
||||
/* apply motion compensation */
|
||||
if (!is_intra)
|
||||
mc_with_delta_func(band->buf + buf_offs,
|
||||
band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
|
||||
band->pitch, mc_type);
|
||||
ret = ivi_decode_coded_blocks(gb, band, mc_with_delta_func,
|
||||
mv_x, mv_y, &prev_dc, is_intra,
|
||||
mc_type, quant, buf_offs, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
/* block not coded */
|
||||
/* for intra blocks apply the dc slant transform */
|
||||
/* for inter - perform the motion compensation without delta */
|
||||
if (is_intra) {
|
||||
band->dc_transform(&prev_dc, band->buf + buf_offs,
|
||||
band->pitch, blk_size);
|
||||
} else
|
||||
mc_no_delta_func(band->buf + buf_offs,
|
||||
band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
|
||||
band->pitch, mc_type);
|
||||
ret = ivi_dc_transform(band, &prev_dc, buf_offs, blk_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
ret = ivi_mc(band, mc_no_delta_func, buf_offs,
|
||||
mv_x, mv_y, mc_type);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
cbp >>= 1;
|
||||
@@ -568,12 +660,11 @@ static int ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
||||
IVITile *tile, int32_t mv_scale)
|
||||
{
|
||||
int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type;
|
||||
int offs, mb_offset, row_offset;
|
||||
int offs, mb_offset, row_offset, ret;
|
||||
IVIMbInfo *mb, *ref_mb;
|
||||
const int16_t *src;
|
||||
int16_t *dst;
|
||||
void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch,
|
||||
int mc_type);
|
||||
ivi_mc_func mc_no_delta_func;
|
||||
|
||||
if (tile->num_MBs != IVI_MBs_PER_TILE(tile->width, tile->height, band->mb_size)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Allocated tile size %d mismatches "
|
||||
@@ -663,9 +754,10 @@ static int ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
|
||||
for (blk = 0; blk < num_blocks; blk++) {
|
||||
/* adjust block position in the buffer according with its number */
|
||||
offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch);
|
||||
mc_no_delta_func(band->buf + offs,
|
||||
band->ref_buf + offs + mv_y * band->pitch + mv_x,
|
||||
band->pitch, mc_type);
|
||||
ret = ivi_mc(band, mc_no_delta_func, offs,
|
||||
mv_x, mv_y, mc_type);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -804,8 +896,16 @@ static int decode_band(IVI45DecContext *ctx,
|
||||
break;
|
||||
|
||||
result = ivi_decode_blocks(&ctx->gb, band, tile, avctx);
|
||||
if (result < 0 || ((get_bits_count(&ctx->gb) - pos) >> 3) != tile->data_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Corrupted tile data encountered!\n");
|
||||
if (result < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Corrupted tile data encountered!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (((get_bits_count(&ctx->gb) - pos) >> 3) != tile->data_size) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Tile data_size mismatch!\n");
|
||||
result = AVERROR_INVALIDDATA;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -813,7 +913,8 @@ static int decode_band(IVI45DecContext *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
/* restore the selected rvmap table by applying its corrections in reverse order */
|
||||
/* restore the selected rvmap table by applying its corrections in
|
||||
* reverse order */
|
||||
for (i = band->num_corr-1; i >= 0; i--) {
|
||||
idx1 = band->corr[i*2];
|
||||
idx2 = band->corr[i*2+1];
|
||||
@@ -830,7 +931,8 @@ static int decode_band(IVI45DecContext *ctx,
|
||||
uint16_t chksum = ivi_calc_band_checksum(band);
|
||||
if (chksum != band->checksum) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Band checksum mismatch! Plane %d, band %d, received: %x, calculated: %x\n",
|
||||
"Band checksum mismatch! Plane %d, band %d, "
|
||||
"received: %x, calculated: %x\n",
|
||||
band->plane, band->band_num, band->checksum, chksum);
|
||||
}
|
||||
}
|
||||
@@ -857,14 +959,19 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
if (result) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error while decoding picture header: %d\n", result);
|
||||
return -1;
|
||||
return result;
|
||||
}
|
||||
if (ctx->gop_invalid)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (ctx->gop_flags & IVI5_IS_PROTECTED) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Password-protected clip!\n");
|
||||
return -1;
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if (!ctx->planes[0].bands) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Color planes not initialized yet\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ctx->switch_buffers(ctx);
|
||||
@@ -876,24 +983,35 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
for (p = 0; p < 3; p++) {
|
||||
for (b = 0; b < ctx->planes[p].num_bands; b++) {
|
||||
result = decode_band(ctx, &ctx->planes[p].bands[b], avctx);
|
||||
if (result) {
|
||||
if (result < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error while decoding band: %d, plane: %d\n", b, p);
|
||||
return -1;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx->buf_invalid[ctx->dst_buf] = 0;
|
||||
} else {
|
||||
if (ctx->is_scalable)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (p = 0; p < 3; p++) {
|
||||
if (!ctx->planes[p].bands[0].buf)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (ctx->buf_invalid[ctx->dst_buf])
|
||||
return -1;
|
||||
|
||||
//STOP_TIMER("decode_planes"); }
|
||||
|
||||
/* If the bidirectional mode is enabled, next I and the following P frame will */
|
||||
/* be sent together. Unfortunately the approach below seems to be the only way */
|
||||
/* to handle the B-frames mode. That's exactly the same Intel decoders do. */
|
||||
if (avctx->codec_id == AV_CODEC_ID_INDEO4 && ctx->frame_type == 0/*FRAMETYPE_INTRA*/) {
|
||||
/* If the bidirectional mode is enabled, next I and the following P
|
||||
* frame will be sent together. Unfortunately the approach below seems
|
||||
* to be the only way to handle the B-frames mode.
|
||||
* That's exactly the same Intel decoders do.
|
||||
*/
|
||||
if (avctx->codec_id == AV_CODEC_ID_INDEO4 &&
|
||||
ctx->frame_type == 0/*FRAMETYPE_INTRA*/) {
|
||||
while (get_bits(&ctx->gb, 8)); // skip version string
|
||||
skip_bits_long(&ctx->gb, 64); // skip padding, TODO: implement correct 8-bytes alignment
|
||||
if (get_bits_left(&ctx->gb) > 18 && show_bits(&ctx->gb, 18) == 0x3FFF8)
|
||||
|
@@ -160,9 +160,9 @@ typedef struct IVIBandDesc {
|
||||
int num_tiles; ///< number of tiles in this band
|
||||
IVITile *tiles; ///< array of tile descriptors
|
||||
InvTransformPtr *inv_transform;
|
||||
int transform_size;
|
||||
DCTransformPtr *dc_transform;
|
||||
int is_2d_trans; ///< 1 indicates that the two-dimensional inverse transform is used
|
||||
int transform_size; ///< block size of the transform
|
||||
int32_t checksum; ///< for debug purposes
|
||||
int checksum_present;
|
||||
int bufsize; ///< band buffer size in bytes
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "bytestream.h"
|
||||
#include "internal.h"
|
||||
#include "j2k.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/common.h"
|
||||
|
||||
#define JP2_SIG_TYPE 0x6A502020
|
||||
@@ -302,6 +303,10 @@ static int get_cox(J2kDecoderContext *s, J2kCodingStyle *c)
|
||||
c->log2_cblk_width = bytestream2_get_byteu(&s->g) + 2; // cblk width
|
||||
c->log2_cblk_height = bytestream2_get_byteu(&s->g) + 2; // cblk height
|
||||
|
||||
if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) {
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
c->cblk_style = bytestream2_get_byteu(&s->g);
|
||||
if (c->cblk_style != 0){ // cblk style
|
||||
av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style);
|
||||
@@ -719,6 +724,9 @@ static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Contex
|
||||
int bpass_csty_symbol = J2K_CBLK_BYPASS & codsty->cblk_style;
|
||||
int vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style;
|
||||
|
||||
av_assert0(width <= J2K_MAX_CBLKW);
|
||||
av_assert0(height <= J2K_MAX_CBLKH);
|
||||
|
||||
for (y = 0; y < height+2; y++)
|
||||
memset(t1->flags[y], 0, (width+2)*sizeof(int));
|
||||
|
||||
|
@@ -70,13 +70,13 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
|
||||
case 2:
|
||||
case 3:
|
||||
av_log(s->avctx, AV_LOG_ERROR, "palette not supported\n");
|
||||
return -1;
|
||||
return AVERROR(ENOSYS);
|
||||
case 4:
|
||||
av_log(s->avctx, AV_LOG_ERROR, "oversize image not supported\n");
|
||||
return -1;
|
||||
return AVERROR(ENOSYS);
|
||||
default:
|
||||
av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
av_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
|
||||
|
||||
@@ -262,7 +262,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
|
||||
int i, t = 0;
|
||||
uint8_t *zero, *last, *cur;
|
||||
JLSState *state;
|
||||
int off = 0, stride = 1, width, shift;
|
||||
int off = 0, stride = 1, width, shift, ret = 0;
|
||||
|
||||
zero = av_mallocz(s->picture.linesize[0]);
|
||||
last = zero;
|
||||
@@ -294,6 +294,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
|
||||
ilv, point_transform, s->bits, s->cur_scan);
|
||||
}
|
||||
if(ilv == 0) { /* separate planes */
|
||||
if (s->cur_scan > s->nb_components) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto end;
|
||||
}
|
||||
stride = (s->nb_components > 1) ? 3 : 1;
|
||||
off = av_clip(s->cur_scan - 1, 0, stride - 1);
|
||||
width = s->width * stride;
|
||||
@@ -333,11 +337,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
|
||||
last = cur;
|
||||
cur += s->picture.linesize[0];
|
||||
}
|
||||
} else if(ilv == 2) { /* sample interleaving */
|
||||
} else if (ilv == 2) { /* sample interleaving */
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Sample interleaved images are not supported.\n");
|
||||
av_free(state);
|
||||
av_free(zero);
|
||||
return -1;
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(shift){ /* we need to do point transform or normalize samples */
|
||||
@@ -365,10 +368,12 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
av_free(state);
|
||||
av_free(zero);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "internal.h"
|
||||
#include "libavutil/common.h"
|
||||
|
||||
#define KMVC_KEYFRAME 0x80
|
||||
#define KMVC_PALETTE 0x40
|
||||
@@ -47,7 +48,7 @@ typedef struct KmvcContext {
|
||||
int palsize;
|
||||
uint32_t pal[MAX_PALSIZE];
|
||||
uint8_t *cur, *prev;
|
||||
uint8_t *frm0, *frm1;
|
||||
uint8_t frm0[320 * 200], frm1[320 * 200];
|
||||
GetByteContext g;
|
||||
} KmvcContext;
|
||||
|
||||
@@ -56,7 +57,7 @@ typedef struct BitBuf {
|
||||
int bitbuf;
|
||||
} BitBuf;
|
||||
|
||||
#define BLK(data, x, y) data[(x) + (y) * 320]
|
||||
#define BLK(data, x, y) data[av_clip((x) + (y) * 320, 0, 320 * 200 -1)]
|
||||
|
||||
#define kmvc_init_getbits(bb, g) bb.bits = 7; bb.bitbuf = bytestream2_get_byte(g);
|
||||
|
||||
@@ -107,7 +108,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = val & 0xF;
|
||||
my = val >> 4;
|
||||
if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 316*196) {
|
||||
if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 320*197 - 4) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -132,7 +133,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = val & 0xF;
|
||||
my = val >> 4;
|
||||
if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 318*198) {
|
||||
if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 320*199 - 2) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -207,7 +208,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = (val & 0xF) - 8;
|
||||
my = (val >> 4) - 8;
|
||||
if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 318*198) {
|
||||
if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 320*197 - 4) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -232,7 +233,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h)
|
||||
val = bytestream2_get_byte(&ctx->g);
|
||||
mx = (val & 0xF) - 8;
|
||||
my = (val >> 4) - 8;
|
||||
if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 318*198) {
|
||||
if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 320*199 - 2) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -386,8 +387,6 @@ static av_cold int decode_init(AVCodecContext * avctx)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
c->frm0 = av_mallocz(320 * 200);
|
||||
c->frm1 = av_mallocz(320 * 200);
|
||||
c->cur = c->frm0;
|
||||
c->prev = c->frm1;
|
||||
|
||||
@@ -423,30 +422,12 @@ static av_cold int decode_init(AVCodecContext * avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Uninit kmvc decoder
|
||||
*/
|
||||
static av_cold int decode_end(AVCodecContext * avctx)
|
||||
{
|
||||
KmvcContext *const c = avctx->priv_data;
|
||||
|
||||
av_freep(&c->frm0);
|
||||
av_freep(&c->frm1);
|
||||
if (c->pic.data[0])
|
||||
avctx->release_buffer(avctx, &c->pic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec ff_kmvc_decoder = {
|
||||
.name = "kmvc",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_KMVC,
|
||||
.priv_data_size = sizeof(KmvcContext),
|
||||
.init = decode_init,
|
||||
.close = decode_end,
|
||||
.decode = decode_frame,
|
||||
.capabilities = CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),
|
||||
|
@@ -107,6 +107,9 @@ static inline uint8_t lag_get_rac(lag_rac *l)
|
||||
l->range -= range_scaled * l->prob[255];
|
||||
}
|
||||
|
||||
if (!l->range)
|
||||
l->range = 0x80;
|
||||
|
||||
l->low -= range_scaled * l->prob[val];
|
||||
|
||||
return val;
|
||||
|
@@ -218,7 +218,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
}
|
||||
} else {
|
||||
lame_result = lame_encode_flush(s->gfp, s->buffer + s->buffer_index,
|
||||
BUFFER_SIZE - s->buffer_index);
|
||||
s->buffer_size - s->buffer_index);
|
||||
}
|
||||
if (lame_result < 0) {
|
||||
if (lame_result == -1) {
|
||||
|
@@ -50,41 +50,6 @@ static int amr_decode_fix_avctx(AVCodecContext *avctx)
|
||||
#include <opencore-amrnb/interf_dec.h>
|
||||
#include <opencore-amrnb/interf_enc.h>
|
||||
|
||||
/* Common code for fixed and float version*/
|
||||
typedef struct AMR_bitrates {
|
||||
int rate;
|
||||
enum Mode mode;
|
||||
} AMR_bitrates;
|
||||
|
||||
/* Match desired bitrate */
|
||||
static int get_bitrate_mode(int bitrate, void *log_ctx)
|
||||
{
|
||||
/* make the correspondance between bitrate and mode */
|
||||
static const AMR_bitrates rates[] = {
|
||||
{ 4750, MR475 }, { 5150, MR515 }, { 5900, MR59 }, { 6700, MR67 },
|
||||
{ 7400, MR74 }, { 7950, MR795 }, { 10200, MR102 }, { 12200, MR122 }
|
||||
};
|
||||
int i, best = -1, min_diff = 0;
|
||||
char log_buf[200];
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (rates[i].rate == bitrate)
|
||||
return rates[i].mode;
|
||||
if (best < 0 || abs(rates[i].rate - bitrate) < min_diff) {
|
||||
best = i;
|
||||
min_diff = abs(rates[i].rate - bitrate);
|
||||
}
|
||||
}
|
||||
/* no bitrate matching exactly, log a warning */
|
||||
snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of ");
|
||||
for (i = 0; i < 8; i++)
|
||||
av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i].rate / 1000.f);
|
||||
av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best].rate / 1000.f);
|
||||
av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf);
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
typedef struct AMRContext {
|
||||
AVClass *av_class;
|
||||
AVFrame frame;
|
||||
@@ -97,15 +62,7 @@ typedef struct AMRContext {
|
||||
AudioFrameQueue afq;
|
||||
} AMRContext;
|
||||
|
||||
static const AVOption options[] = {
|
||||
{ "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const AVClass class = {
|
||||
"libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
|
||||
};
|
||||
|
||||
#if CONFIG_LIBOPENCORE_AMRNB_DECODER
|
||||
static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
AMRContext *s = avctx->priv_data;
|
||||
@@ -186,6 +143,52 @@ AVCodec ff_libopencore_amrnb_decoder = {
|
||||
.capabilities = CODEC_CAP_DR1,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"),
|
||||
};
|
||||
#endif /* CONFIG_LIBOPENCORE_AMRNB_DECODER */
|
||||
|
||||
#if CONFIG_LIBOPENCORE_AMRNB_ENCODER
|
||||
/* Common code for fixed and float version*/
|
||||
typedef struct AMR_bitrates {
|
||||
int rate;
|
||||
enum Mode mode;
|
||||
} AMR_bitrates;
|
||||
|
||||
/* Match desired bitrate */
|
||||
static int get_bitrate_mode(int bitrate, void *log_ctx)
|
||||
{
|
||||
/* make the correspondance between bitrate and mode */
|
||||
static const AMR_bitrates rates[] = {
|
||||
{ 4750, MR475 }, { 5150, MR515 }, { 5900, MR59 }, { 6700, MR67 },
|
||||
{ 7400, MR74 }, { 7950, MR795 }, { 10200, MR102 }, { 12200, MR122 }
|
||||
};
|
||||
int i, best = -1, min_diff = 0;
|
||||
char log_buf[200];
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (rates[i].rate == bitrate)
|
||||
return rates[i].mode;
|
||||
if (best < 0 || abs(rates[i].rate - bitrate) < min_diff) {
|
||||
best = i;
|
||||
min_diff = abs(rates[i].rate - bitrate);
|
||||
}
|
||||
}
|
||||
/* no bitrate matching exactly, log a warning */
|
||||
snprintf(log_buf, sizeof(log_buf), "bitrate not supported: use one of ");
|
||||
for (i = 0; i < 8; i++)
|
||||
av_strlcatf(log_buf, sizeof(log_buf), "%.2fk, ", rates[i].rate / 1000.f);
|
||||
av_strlcatf(log_buf, sizeof(log_buf), "using %.2fk", rates[best].rate / 1000.f);
|
||||
av_log(log_ctx, AV_LOG_WARNING, "%s\n", log_buf);
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
static const AVOption options[] = {
|
||||
{ "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const AVClass class = {
|
||||
"libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
|
||||
};
|
||||
|
||||
static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
@@ -304,11 +307,12 @@ AVCodec ff_libopencore_amrnb_encoder = {
|
||||
.long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band)"),
|
||||
.priv_class = &class,
|
||||
};
|
||||
#endif /* CONFIG_LIBOPENCORE_AMRNB_ENCODER */
|
||||
|
||||
#endif
|
||||
#endif /* CONFIG_LIBOPENCORE_AMRNB */
|
||||
|
||||
/* -----------AMR wideband ------------*/
|
||||
#if CONFIG_LIBOPENCORE_AMRWB
|
||||
#if CONFIG_LIBOPENCORE_AMRWB_DECODER
|
||||
|
||||
#include <opencore-amrwb/dec_if.h>
|
||||
#include <opencore-amrwb/if_rom.h>
|
||||
@@ -392,4 +396,4 @@ AVCodec ff_libopencore_amrwb_decoder = {
|
||||
.long_name = NULL_IF_CONFIG_SMALL("OpenCORE AMR-WB (Adaptive Multi-Rate Wide-Band)"),
|
||||
};
|
||||
|
||||
#endif /* CONFIG_LIBOPENCORE_AMRWB */
|
||||
#endif /* CONFIG_LIBOPENCORE_AMRWB_DECODER */
|
||||
|
@@ -174,7 +174,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
|
||||
frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P :
|
||||
frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B :
|
||||
X264_TYPE_AUTO;
|
||||
if (x4->params.b_tff != frame->top_field_first) {
|
||||
if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) {
|
||||
x4->params.b_tff = frame->top_field_first;
|
||||
x264_encoder_reconfig(x4->enc, &x4->params);
|
||||
}
|
||||
|
@@ -181,7 +181,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
p->key_frame = 1;
|
||||
|
||||
#define ADVANCE_BY_DECODED do { \
|
||||
if (decoded < 0) goto stop; \
|
||||
if (decoded < 0 || decoded >= buf_size) goto buf_too_small; \
|
||||
buf += decoded; buf_size -= decoded; \
|
||||
} while(0)
|
||||
switch(l->mode) {
|
||||
@@ -215,7 +215,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 2, avctx->width, avctx->height,
|
||||
-p->linesize[0], buf, buf_size, 3);
|
||||
break;
|
||||
case LOCO_CRGBA: case LOCO_RGBA:
|
||||
case LOCO_CRGBA:
|
||||
case LOCO_RGBA:
|
||||
decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1), avctx->width, avctx->height,
|
||||
-p->linesize[0], buf, buf_size, 4);
|
||||
ADVANCE_BY_DECODED;
|
||||
@@ -229,15 +230,18 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
-p->linesize[0], buf, buf_size, 4);
|
||||
break;
|
||||
}
|
||||
stop:
|
||||
|
||||
*got_frame = 1;
|
||||
*(AVFrame*)data = l->pic;
|
||||
|
||||
return buf_size < 0 ? -1 : avpkt->size - buf_size;
|
||||
buf_too_small:
|
||||
av_log(avctx, AV_LOG_ERROR, "Input data too small.\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
static av_cold int decode_init(AVCodecContext *avctx){
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
LOCOContext * const l = avctx->priv_data;
|
||||
int version;
|
||||
|
||||
|
@@ -229,8 +229,8 @@ static av_cold int mace_decode_init(AVCodecContext * avctx)
|
||||
{
|
||||
MACEContext *ctx = avctx->priv_data;
|
||||
|
||||
if (avctx->channels > 2 || avctx->channels <= 0)
|
||||
return -1;
|
||||
if (avctx->channels > 2 || avctx->channels < 1)
|
||||
return AVERROR(EINVAL);
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
|
||||
|
||||
avcodec_get_frame_defaults(&ctx->frame);
|
||||
|
@@ -254,7 +254,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
return -1;
|
||||
if (s->interlaced && (s->bottom_field == !s->interlace_polarity)) {
|
||||
if (nb_components != s->nb_components) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "nb_components changing in interlaced picture\n");
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"nb_components changing in interlaced picture\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
@@ -279,15 +280,18 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
s->h_max = h_count[i];
|
||||
if (v_count[i] > s->v_max)
|
||||
s->v_max = v_count[i];
|
||||
if (!h_count[i] || !v_count[i]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "h/v_count is 0\n");
|
||||
return -1;
|
||||
}
|
||||
s->quant_index[i] = get_bits(&s->gb, 8);
|
||||
if (s->quant_index[i] >= 4) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "quant_index is invalid\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (!h_count[i] || !v_count[i]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR,
|
||||
"Invalid sampling factor in component %d %d:%d\n",
|
||||
i, h_count[i], v_count[i]);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n",
|
||||
i, h_count[i], v_count[i],
|
||||
s->component_id[i], s->quant_index[i]);
|
||||
@@ -740,7 +744,9 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
|
||||
|
||||
i = 8 + ((-get_bits_count(&s->gb)) & 7);
|
||||
/* skip RSTn */
|
||||
if (s->restart_count == 0 && show_bits(&s->gb, i) == (1 << i) - 1) {
|
||||
if (s->restart_count == 0) {
|
||||
if( show_bits(&s->gb, i) == (1 << i) - 1
|
||||
|| show_bits(&s->gb, i) == 0xFF) {
|
||||
int pos = get_bits_count(&s->gb);
|
||||
align_get_bits(&s->gb);
|
||||
while (get_bits_left(&s->gb) >= 8 && show_bits(&s->gb, 8) == 0xFF)
|
||||
@@ -750,6 +756,7 @@ static void handle_rstn(MJpegDecodeContext *s, int nb_components)
|
||||
s->last_dc[i] = 1024;
|
||||
} else
|
||||
skip_bits_long(&s->gb, pos - get_bits_count(&s->gb));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -764,6 +771,12 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
int resync_mb_y = 0;
|
||||
int resync_mb_x = 0;
|
||||
|
||||
if (s->nb_components != 3 && s->nb_components != 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
|
||||
s->restart_count = s->restart_interval;
|
||||
|
||||
av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size,
|
||||
@@ -842,17 +855,16 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
}
|
||||
|
||||
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
|
||||
int point_transform)
|
||||
int point_transform, int nb_components)
|
||||
{
|
||||
int i, mb_x, mb_y;
|
||||
const int nb_components=s->nb_components;
|
||||
int bits= (s->bits+7)&~7;
|
||||
int resync_mb_y = 0;
|
||||
int resync_mb_x = 0;
|
||||
|
||||
point_transform += bits - s->bits;
|
||||
|
||||
av_assert0(nb_components==1 || nb_components==3);
|
||||
av_assert0(nb_components>=1 && nb_components<=3);
|
||||
|
||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||
@@ -1121,8 +1133,9 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
|
||||
int last_scan = 0;
|
||||
int16_t *quant_matrix = s->quant_matrixes[s->quant_index[c]];
|
||||
|
||||
if (se > 63) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "SE %d is too large\n", se);
|
||||
av_assert0(ss>=0 && Ah>=0 && Al>=0);
|
||||
if (se < ss || se > 63) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "SS/SE %d/%d is invalid\n", ss, se);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -1284,7 +1297,9 @@ next_field:
|
||||
if ((ret = ljpeg_decode_rgb_scan(s, nb_components, predictor, point_transform)) < 0)
|
||||
return ret;
|
||||
} else {
|
||||
if ((ret = ljpeg_decode_yuv_scan(s, predictor, point_transform)) < 0)
|
||||
if ((ret = ljpeg_decode_yuv_scan(s, predictor,
|
||||
point_transform,
|
||||
nb_components)) < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -1630,6 +1645,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
MJpegDecodeContext *s = avctx->priv_data;
|
||||
const uint8_t *buf_end, *buf_ptr;
|
||||
const uint8_t *unescaped_buf_ptr;
|
||||
int hshift, vshift;
|
||||
int unescaped_buf_size;
|
||||
int start_code;
|
||||
int i, index;
|
||||
@@ -1646,15 +1662,20 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
/* EOF */
|
||||
if (start_code < 0) {
|
||||
goto the_end;
|
||||
} else if (unescaped_buf_size > (1U<<28)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (0x%x/0x%x), corrupt data?\n",
|
||||
} else if (unescaped_buf_size > INT_MAX / 8) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"MJPEG packet 0x%x too big (%d/%d), corrupt data?\n",
|
||||
start_code, unescaped_buf_size, buf_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
|
||||
start_code, buf_end - buf_ptr);
|
||||
|
||||
init_get_bits(&s->gb, unescaped_buf_ptr, unescaped_buf_size * 8);
|
||||
ret = init_get_bits(&s->gb, unescaped_buf_ptr,
|
||||
unescaped_buf_size * 8);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
s->start_code = start_code;
|
||||
if (s->avctx->debug & FF_DEBUG_STARTCODE)
|
||||
@@ -1672,6 +1693,13 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
mjpeg_decode_com(s);
|
||||
|
||||
ret = -1;
|
||||
|
||||
if (!CONFIG_JPEGLS_DECODER &&
|
||||
(start_code == SOF48 || start_code == LSE)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "JPEG-LS support not enabled.\n");
|
||||
return AVERROR(ENOSYS);
|
||||
}
|
||||
|
||||
switch (start_code) {
|
||||
case SOI:
|
||||
s->restart_interval = 0;
|
||||
@@ -1808,6 +1836,9 @@ the_end:
|
||||
}
|
||||
if (s->upscale_v) {
|
||||
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]];
|
||||
int w;
|
||||
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
|
||||
w = s->width >> hshift;
|
||||
av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
|
||||
avctx->pix_fmt == AV_PIX_FMT_YUV444P ||
|
||||
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
|
||||
@@ -1816,16 +1847,16 @@ the_end:
|
||||
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]];
|
||||
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]];
|
||||
if (src1 == src2) {
|
||||
memcpy(dst, src1, s->width);
|
||||
memcpy(dst, src1, w);
|
||||
} else {
|
||||
for (index = 0; index < s->width; index++)
|
||||
for (index = 0; index < w; index++)
|
||||
dst[index] = (src1[index] + src2[index]) >> 1;
|
||||
}
|
||||
dst -= s->linesize[s->upscale_v];
|
||||
}
|
||||
}
|
||||
if (s->flipped && (s->avctx->flags & CODEC_FLAG_EMU_EDGE)) {
|
||||
int hshift, vshift, j;
|
||||
int j;
|
||||
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
|
||||
for (index=0; index<4; index++) {
|
||||
uint8_t *dst = s->picture_ptr->data[index];
|
||||
|
@@ -126,7 +126,7 @@ uint64_t ff_truehd_layout(int chanmap)
|
||||
|
||||
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
|
||||
{
|
||||
int ratebits;
|
||||
int ratebits, channel_arrangement;
|
||||
uint16_t checksum;
|
||||
|
||||
av_assert1(get_bits_count(gb) == 0);
|
||||
@@ -157,7 +157,10 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
|
||||
|
||||
skip_bits(gb, 11);
|
||||
|
||||
mh->channels_mlp = get_bits(gb, 5);
|
||||
mh->channel_arrangement=
|
||||
channel_arrangement = get_bits(gb, 5);
|
||||
mh->channels_mlp = mlp_channels[channel_arrangement];
|
||||
mh->channel_layout_mlp = ff_mlp_layout[channel_arrangement];
|
||||
} else if (mh->stream_type == 0xba) {
|
||||
mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere?
|
||||
mh->group2_bits = 0;
|
||||
@@ -168,11 +171,16 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
|
||||
|
||||
skip_bits(gb, 8);
|
||||
|
||||
mh->channels_thd_stream1 = get_bits(gb, 5);
|
||||
mh->channel_arrangement=
|
||||
channel_arrangement = get_bits(gb, 5);
|
||||
mh->channels_thd_stream1 = truehd_channels(channel_arrangement);
|
||||
mh->channel_layout_thd_stream1 = ff_truehd_layout(channel_arrangement);
|
||||
|
||||
skip_bits(gb, 2);
|
||||
|
||||
mh->channels_thd_stream2 = get_bits(gb, 13);
|
||||
channel_arrangement = get_bits(gb, 13);
|
||||
mh->channels_thd_stream2 = truehd_channels(channel_arrangement);
|
||||
mh->channel_layout_thd_stream2 = ff_truehd_layout(channel_arrangement);
|
||||
} else
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -322,16 +330,16 @@ static int mlp_parse(AVCodecParserContext *s,
|
||||
if(!avctx->channels || !avctx->channel_layout) {
|
||||
if (mh.stream_type == 0xbb) {
|
||||
/* MLP stream */
|
||||
avctx->channels = mlp_channels[mh.channels_mlp];
|
||||
avctx->channel_layout = ff_mlp_layout[mh.channels_mlp];
|
||||
avctx->channels = mh.channels_mlp;
|
||||
avctx->channel_layout = mh.channel_layout_mlp;
|
||||
} else { /* mh.stream_type == 0xba */
|
||||
/* TrueHD stream */
|
||||
if (mh.channels_thd_stream2) {
|
||||
avctx->channels = truehd_channels(mh.channels_thd_stream2);
|
||||
avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream2);
|
||||
avctx->channels = mh.channels_thd_stream2;
|
||||
avctx->channel_layout = mh.channel_layout_thd_stream2;
|
||||
} else {
|
||||
avctx->channels = truehd_channels(mh.channels_thd_stream1);
|
||||
avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream1);
|
||||
avctx->channels = mh.channels_thd_stream1;
|
||||
avctx->channel_layout = mh.channel_layout_thd_stream1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,9 +39,13 @@ typedef struct MLPHeaderInfo
|
||||
int group1_samplerate; ///< Sample rate of first substream
|
||||
int group2_samplerate; ///< Sample rate of second substream (MLP only)
|
||||
|
||||
int channels_mlp; ///< Channel arrangement for MLP streams
|
||||
int channels_thd_stream1; ///< Channel arrangement for substream 1 of TrueHD streams (5.1)
|
||||
int channels_thd_stream2; ///< Channel arrangement for substream 2 of TrueHD streams (7.1)
|
||||
int channel_arrangement;
|
||||
int channels_mlp; ///< Channel count for MLP streams
|
||||
int channels_thd_stream1; ///< Channel count for substream 1 of TrueHD streams ("6-channel presentation")
|
||||
int channels_thd_stream2; ///< Channel count for substream 2 of TrueHD streams ("8-channel presentation")
|
||||
uint64_t channel_layout_mlp; ///< Channel layout for MLP streams
|
||||
uint64_t channel_layout_thd_stream1; ///< Channel layout for substream 1 of TrueHD streams ("6-channel presentation")
|
||||
uint64_t channel_layout_thd_stream2; ///< Channel layout for substream 2 of TrueHD streams ("8-channel presentation")
|
||||
|
||||
int access_unit_size; ///< Number of samples per coded frame
|
||||
int access_unit_size_pow2; ///< Next power of two above number of samples per frame
|
||||
|
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "get_bits.h"
|
||||
#include "internal.h"
|
||||
#include "libavutil/crc.h"
|
||||
@@ -56,6 +57,8 @@ typedef struct SubStream {
|
||||
uint8_t max_matrix_channel;
|
||||
/// For each channel output by the matrix, the output channel to map it to
|
||||
uint8_t ch_assign[MAX_CHANNELS];
|
||||
/// The channel layout for this substream
|
||||
uint64_t ch_layout;
|
||||
|
||||
/// Channel coding parameters for channels in the substream
|
||||
ChannelParams channel_params[MAX_CHANNELS];
|
||||
@@ -149,6 +152,36 @@ typedef struct MLPDecodeContext {
|
||||
MLPDSPContext dsp;
|
||||
} MLPDecodeContext;
|
||||
|
||||
static const uint64_t thd_channel_order[] = {
|
||||
AV_CH_FRONT_LEFT, AV_CH_FRONT_RIGHT, // LR
|
||||
AV_CH_FRONT_CENTER, // C
|
||||
AV_CH_LOW_FREQUENCY, // LFE
|
||||
AV_CH_SIDE_LEFT, AV_CH_SIDE_RIGHT, // LRs
|
||||
AV_CH_TOP_FRONT_LEFT, AV_CH_TOP_FRONT_RIGHT, // LRvh
|
||||
AV_CH_FRONT_LEFT_OF_CENTER, AV_CH_FRONT_RIGHT_OF_CENTER, // LRc
|
||||
AV_CH_BACK_LEFT, AV_CH_BACK_RIGHT, // LRrs
|
||||
AV_CH_BACK_CENTER, // Cs
|
||||
AV_CH_TOP_CENTER, // Ts
|
||||
AV_CH_SURROUND_DIRECT_LEFT, AV_CH_SURROUND_DIRECT_RIGHT, // LRsd
|
||||
AV_CH_WIDE_LEFT, AV_CH_WIDE_RIGHT, // LRw
|
||||
AV_CH_TOP_FRONT_CENTER, // Cvh
|
||||
AV_CH_LOW_FREQUENCY_2, // LFE2
|
||||
};
|
||||
|
||||
static uint64_t thd_channel_layout_extract_channel(uint64_t channel_layout,
|
||||
int index)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (av_get_channel_layout_nb_channels(channel_layout) <= index)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(thd_channel_order); i++)
|
||||
if (channel_layout & thd_channel_order[i] && !index--)
|
||||
return thd_channel_order[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static VLC huff_vlc[3];
|
||||
|
||||
/** Initialize static data, constant between all invocations of the codec. */
|
||||
@@ -328,31 +361,32 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
|
||||
for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
|
||||
m->substream[substr].restart_seen = 0;
|
||||
|
||||
if (mh.stream_type == 0xbb) {
|
||||
/* MLP stream */
|
||||
m->avctx->channel_layout = ff_mlp_layout[mh.channels_mlp];
|
||||
} else { /* mh.stream_type == 0xba */
|
||||
/* TrueHD stream */
|
||||
if (mh.channels_thd_stream2) {
|
||||
m->avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream2);
|
||||
} else {
|
||||
m->avctx->channel_layout = ff_truehd_layout(mh.channels_thd_stream1);
|
||||
}
|
||||
if (m->avctx->channels<=2 && m->avctx->channel_layout == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
|
||||
/* Set the layout for each substream. When there's more than one, the first
|
||||
* substream is Stereo. Subsequent substreams' layouts are indicated in the
|
||||
* major sync. */
|
||||
if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
|
||||
if ((substr = (mh.num_substreams > 1)))
|
||||
m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
|
||||
m->substream[substr].ch_layout = mh.channel_layout_mlp;
|
||||
} else {
|
||||
if ((substr = (mh.num_substreams > 1)))
|
||||
m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO;
|
||||
if (mh.num_substreams > 2)
|
||||
if (mh.channel_layout_thd_stream2)
|
||||
m->substream[2].ch_layout = mh.channel_layout_thd_stream2;
|
||||
else
|
||||
m->substream[2].ch_layout = mh.channel_layout_thd_stream1;
|
||||
m->substream[substr].ch_layout = mh.channel_layout_thd_stream1;
|
||||
|
||||
if (m->avctx->channels<=2 && m->substream[substr].ch_layout == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
|
||||
av_log(m->avctx, AV_LOG_DEBUG, "Mono stream with 2 substreams, ignoring 2nd\n");
|
||||
m->max_decoded_substream = 0;
|
||||
if (m->avctx->channels==2)
|
||||
m->avctx->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
if (m->avctx->channels &&
|
||||
!m->avctx->request_channels && !m->avctx->request_channel_layout &&
|
||||
av_get_channel_layout_nb_channels(m->avctx->channel_layout) != m->avctx->channels) {
|
||||
m->avctx->channel_layout = 0;
|
||||
av_log_ask_for_sample(m->avctx, "Unknown channel layout.");
|
||||
}
|
||||
}
|
||||
|
||||
m->needs_reordering = mh.channels_mlp >= 18 && mh.channels_mlp <= 20;
|
||||
m->needs_reordering = mh.channel_arrangement >= 18 && mh.channel_arrangement <= 20;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -370,10 +404,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
uint8_t checksum;
|
||||
uint8_t lossless_check;
|
||||
int start_count = get_bits_count(gbp);
|
||||
const int max_matrix_channel = m->avctx->codec_id == AV_CODEC_ID_MLP
|
||||
? MAX_MATRIX_CHANNEL_MLP
|
||||
: MAX_MATRIX_CHANNEL_TRUEHD;
|
||||
int max_channel, min_channel, matrix_channel;
|
||||
int min_channel, max_channel, max_matrix_channel;
|
||||
const int std_max_matrix_channel = m->avctx->codec_id == AV_CODEC_ID_MLP
|
||||
? MAX_MATRIX_CHANNEL_MLP
|
||||
: MAX_MATRIX_CHANNEL_TRUEHD;
|
||||
|
||||
sync_word = get_bits(gbp, 13);
|
||||
|
||||
@@ -392,18 +426,18 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
|
||||
skip_bits(gbp, 16); /* Output timestamp */
|
||||
|
||||
min_channel = get_bits(gbp, 4);
|
||||
max_channel = get_bits(gbp, 4);
|
||||
matrix_channel = get_bits(gbp, 4);
|
||||
min_channel = get_bits(gbp, 4);
|
||||
max_channel = get_bits(gbp, 4);
|
||||
max_matrix_channel = get_bits(gbp, 4);
|
||||
|
||||
if (matrix_channel > max_matrix_channel) {
|
||||
if (max_matrix_channel > std_max_matrix_channel) {
|
||||
av_log(m->avctx, AV_LOG_ERROR,
|
||||
"Max matrix channel cannot be greater than %d.\n",
|
||||
max_matrix_channel);
|
||||
std_max_matrix_channel);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (max_channel != matrix_channel) {
|
||||
if (max_channel != max_matrix_channel) {
|
||||
av_log(m->avctx, AV_LOG_ERROR,
|
||||
"Max channel must be equal max matrix channel.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -424,13 +458,14 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->min_channel = min_channel;
|
||||
s->max_channel = max_channel;
|
||||
s->max_matrix_channel = matrix_channel;
|
||||
|
||||
if (m->avctx->request_channels > 0
|
||||
&& s->max_channel + 1 >= m->avctx->request_channels
|
||||
&& substr < m->max_decoded_substream) {
|
||||
s->min_channel = min_channel;
|
||||
s->max_channel = max_channel;
|
||||
s->max_matrix_channel = max_matrix_channel;
|
||||
|
||||
if (m->avctx->request_channels > 0 &&
|
||||
m->avctx->request_channels <= s->max_channel + 1 &&
|
||||
m->max_decoded_substream > substr) {
|
||||
av_log(m->avctx, AV_LOG_DEBUG,
|
||||
"Extracting %d channel downmix from substream %d. "
|
||||
"Further substreams will be skipped.\n",
|
||||
@@ -460,6 +495,12 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
|
||||
for (ch = 0; ch <= s->max_matrix_channel; ch++) {
|
||||
int ch_assign = get_bits(gbp, 6);
|
||||
if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD) {
|
||||
uint64_t channel = thd_channel_layout_extract_channel(s->ch_layout,
|
||||
ch_assign);
|
||||
ch_assign = av_get_channel_layout_channel_index(s->ch_layout,
|
||||
channel);
|
||||
}
|
||||
if (ch_assign > s->max_matrix_channel) {
|
||||
av_log_ask_for_sample(m->avctx,
|
||||
"Assignment of matrix channel %d to invalid output channel %d.\n",
|
||||
@@ -481,20 +522,6 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
FFSWAP(int, s->ch_assign[3], s->ch_assign[5]);
|
||||
}
|
||||
}
|
||||
if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD &&
|
||||
(m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1 ||
|
||||
m->avctx->channel_layout == AV_CH_LAYOUT_7POINT1_WIDE)) {
|
||||
FFSWAP(int, s->ch_assign[4], s->ch_assign[6]);
|
||||
FFSWAP(int, s->ch_assign[5], s->ch_assign[7]);
|
||||
} else if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD &&
|
||||
(m->avctx->channel_layout == AV_CH_LAYOUT_6POINT1 ||
|
||||
m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_CENTER) ||
|
||||
m->avctx->channel_layout == (AV_CH_LAYOUT_6POINT1 | AV_CH_TOP_FRONT_CENTER))) {
|
||||
int i = s->ch_assign[6];
|
||||
s->ch_assign[6] = s->ch_assign[5];
|
||||
s->ch_assign[5] = s->ch_assign[4];
|
||||
s->ch_assign[4] = i;
|
||||
}
|
||||
|
||||
checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count);
|
||||
|
||||
@@ -524,10 +551,9 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
|
||||
cp->huff_lsbs = 24;
|
||||
}
|
||||
|
||||
if (substr == m->max_decoded_substream &&
|
||||
m->avctx->channels != s->max_matrix_channel + 1) {
|
||||
m->avctx->channels = s->max_matrix_channel + 1;
|
||||
m->avctx->channel_layout = 0;
|
||||
if (substr == m->max_decoded_substream) {
|
||||
m->avctx->channels = s->max_matrix_channel + 1;
|
||||
m->avctx->channel_layout = s->ch_layout;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -720,6 +746,7 @@ static int read_channel_params(MLPDecodeContext *m, unsigned int substr,
|
||||
|
||||
if (cp->huff_lsbs > 24) {
|
||||
av_log(m->avctx, AV_LOG_ERROR, "Invalid huff_lsbs.\n");
|
||||
cp->huff_lsbs = 0;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -983,6 +1010,11 @@ static int output_data(MLPDecodeContext *m, unsigned int substr,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (!s->blockpos) {
|
||||
av_log(avctx, AV_LOG_ERROR, "No samples to output.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* get output buffer */
|
||||
m->frame.nb_samples = s->blockpos;
|
||||
if ((ret = ff_get_buffer(avctx, &m->frame)) < 0) {
|
||||
|
@@ -104,6 +104,9 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert)
|
||||
if (half_horiz)
|
||||
run_length *=2;
|
||||
|
||||
if (run_length > s->avctx->width - x)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (color) {
|
||||
memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length);
|
||||
if (half_vert)
|
||||
@@ -151,6 +154,8 @@ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert)
|
||||
int replace_array = bytestream2_get_byte(&s->gb);
|
||||
for(j=0; j<8; j++) {
|
||||
int replace = (replace_array >> (7-j)) & 1;
|
||||
if (x + half_horiz >= s->avctx->width)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (replace) {
|
||||
int color = bytestream2_get_byte(&data_ptr);
|
||||
s->frame.data[0][y*s->frame.linesize[0] + x] = color;
|
||||
|
@@ -1266,7 +1266,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
|
||||
s1->save_width != s->width ||
|
||||
s1->save_height != s->height ||
|
||||
s1->save_aspect_info != s->aspect_ratio_info ||
|
||||
s1->save_progressive_seq != s->progressive_sequence ||
|
||||
(s1->save_progressive_seq != s->progressive_sequence && (s->height&31)) ||
|
||||
0)
|
||||
{
|
||||
|
||||
|
@@ -160,7 +160,7 @@ static inline int mpeg4_is_resync(MpegEncContext *s){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb)
|
||||
static int mpeg4_decode_sprite_trajectory(MpegEncContext *s, GetBitContext *gb)
|
||||
{
|
||||
int i;
|
||||
int a= 2<<s->sprite_warping_accuracy;
|
||||
@@ -176,8 +176,8 @@ static int mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb)
|
||||
int h= s->height;
|
||||
int min_ab;
|
||||
|
||||
if(w<=0 || h<=0)
|
||||
return -1;
|
||||
if (w <= 0 || h <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for(i=0; i<s->num_sprite_warping_points; i++){
|
||||
int length;
|
||||
@@ -415,8 +415,8 @@ int ff_mpeg4_decode_video_packet_header(MpegEncContext *s)
|
||||
skip_bits(&s->gb, 3); /* intra dc vlc threshold */
|
||||
//FIXME don't just ignore everything
|
||||
if(s->pict_type == AV_PICTURE_TYPE_S && s->vol_sprite_usage==GMC_SPRITE){
|
||||
if(mpeg4_decode_sprite_trajectory(s, &s->gb) < 0)
|
||||
return -1;
|
||||
if (mpeg4_decode_sprite_trajectory(s, &s->gb) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(s->avctx, AV_LOG_ERROR, "untested\n");
|
||||
}
|
||||
|
||||
@@ -2081,8 +2081,8 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
|
||||
}
|
||||
|
||||
if(s->pict_type == AV_PICTURE_TYPE_S && (s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE)){
|
||||
if(mpeg4_decode_sprite_trajectory(s, gb) < 0)
|
||||
return -1;
|
||||
if (mpeg4_decode_sprite_trajectory(s, gb) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if(s->sprite_brightness_change) av_log(s->avctx, AV_LOG_ERROR, "sprite_brightness_change not supported\n");
|
||||
if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n");
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ typedef struct MpegAudioParseContext {
|
||||
int frame_size;
|
||||
uint32_t header;
|
||||
int header_count;
|
||||
int no_bitrate;
|
||||
} MpegAudioParseContext;
|
||||
|
||||
#define MPA_HEADER_SIZE 4
|
||||
@@ -77,11 +78,14 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
|
||||
s->header_count++;
|
||||
s->frame_size = ret-4;
|
||||
|
||||
if (s->header_count > 1) {
|
||||
if (s->header_count > 0) {
|
||||
avctx->sample_rate= sr;
|
||||
avctx->channels = channels;
|
||||
s1->duration = frame_size;
|
||||
avctx->bit_rate = bit_rate;
|
||||
if (s->no_bitrate || !avctx->bit_rate) {
|
||||
s->no_bitrate = 1;
|
||||
avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -1965,7 +1965,8 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
|
||||
|
||||
avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header);
|
||||
|
||||
if (ch + m->nb_channels > avctx->channels || s->coff[fr] + m->nb_channels > avctx->channels) {
|
||||
if (ch + m->nb_channels > avctx->channels ||
|
||||
s->coff[fr] + m->nb_channels > avctx->channels) {
|
||||
av_log(avctx, AV_LOG_ERROR, "frame channel count exceeds codec "
|
||||
"channel count\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
@@ -888,7 +888,9 @@ av_cold int ff_MPV_common_init(MpegEncContext *s)
|
||||
s->flags2 = s->avctx->flags2;
|
||||
|
||||
/* set chroma shifts */
|
||||
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
|
||||
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,
|
||||
&s->chroma_x_shift,
|
||||
&s->chroma_y_shift);
|
||||
|
||||
/* convert fourcc to upper case */
|
||||
s->codec_tag = avpriv_toupper4(s->avctx->codec_tag);
|
||||
@@ -2135,7 +2137,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
|
||||
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
|
||||
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
|
||||
|
||||
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) ||
|
||||
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
|
||||
(unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
|
||||
s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y,
|
||||
linesize >> field_based, 17, 17 + field_based,
|
||||
@@ -2175,11 +2177,12 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
|
||||
pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
|
||||
|
||||
if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
|
||||
int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h;
|
||||
uvsx = (uvsx << 2) >> lowres;
|
||||
uvsy = (uvsy << 2) >> lowres;
|
||||
if (h >> s->chroma_y_shift) {
|
||||
pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
|
||||
pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
|
||||
if (hc) {
|
||||
pix_op[op_index](dest_cb, ptr_cb, uvlinesize, hc, uvsx, uvsy);
|
||||
pix_op[op_index](dest_cr, ptr_cr, uvlinesize, hc, uvsx, uvsy);
|
||||
}
|
||||
}
|
||||
// FIXME h261 lowres loop filter
|
||||
|
@@ -731,7 +731,7 @@ typedef struct MpegEncContext {
|
||||
|
||||
#define REBASE_PICTURE(pic, new_ctx, old_ctx) (pic ? \
|
||||
(pic >= old_ctx->picture && pic < old_ctx->picture+old_ctx->picture_count ?\
|
||||
&new_ctx->picture[pic - old_ctx->picture] : pic - (Picture*)old_ctx + (Picture*)new_ctx)\
|
||||
&new_ctx->picture[pic - old_ctx->picture] : (Picture*) ((uint8_t*)pic - (uint8_t*)old_ctx + (uint8_t*)new_ctx))\
|
||||
: NULL)
|
||||
|
||||
/* mpegvideo_enc common options */
|
||||
|
@@ -215,7 +215,8 @@ void mpeg_motion_internal(MpegEncContext *s,
|
||||
{
|
||||
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
|
||||
int dxy, uvdxy, mx, my, src_x, src_y,
|
||||
uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
|
||||
uvsrc_x, uvsrc_y, v_edge_pos;
|
||||
emuedge_linesize_type uvlinesize, linesize;
|
||||
|
||||
#if 0
|
||||
if(s->quarter_sample)
|
||||
|
@@ -138,14 +138,14 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
|
||||
unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3);
|
||||
|
||||
output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
|
||||
output_end = pic->data[0] + avctx->height * pic->linesize[0];
|
||||
output_end = output + FFABS(pic->linesize[0]);
|
||||
|
||||
while (bytestream2_get_bytes_left(gb) > 0) {
|
||||
p1 = bytestream2_get_byteu(gb);
|
||||
if(p1 == 0) { //Escape code
|
||||
p2 = bytestream2_get_byte(gb);
|
||||
if(p2 == 0) { //End-of-line
|
||||
output = pic->data[0] + (--line) * pic->linesize[0];
|
||||
if (line < 0) {
|
||||
if (--line < 0) {
|
||||
if (bytestream2_get_be16(gb) == 1) { // end-of-picture
|
||||
return 0;
|
||||
} else {
|
||||
@@ -155,6 +155,8 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
output = pic->data[0] + line * pic->linesize[0];
|
||||
output_end = output + FFABS(pic->linesize[0]);
|
||||
pos = 0;
|
||||
continue;
|
||||
} else if(p2 == 1) { //End-of-picture
|
||||
@@ -169,11 +171,11 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
|
||||
return -1;
|
||||
}
|
||||
output = pic->data[0] + line * pic->linesize[0] + pos * (depth >> 3);
|
||||
output_end = pic->data[0] + line * pic->linesize[0] + FFABS(pic->linesize[0]);
|
||||
continue;
|
||||
}
|
||||
// Copy data
|
||||
if ((pic->linesize[0] > 0 && output + p2 * (depth >> 3) > output_end) ||
|
||||
(pic->linesize[0] < 0 && output + p2 * (depth >> 3) < output_end)) {
|
||||
if (output + p2 * (depth >> 3) > output_end) {
|
||||
bytestream2_skip(gb, 2 * (depth >> 3));
|
||||
continue;
|
||||
} else if (bytestream2_get_bytes_left(gb) < p2 * (depth >> 3)) {
|
||||
@@ -203,36 +205,39 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
|
||||
pos += p2;
|
||||
} else { //run of pixels
|
||||
uint8_t pix[3]; //original pixel
|
||||
switch(depth){
|
||||
case 8: pix[0] = bytestream2_get_byte(gb);
|
||||
break;
|
||||
case 16: pix16 = bytestream2_get_le16(gb);
|
||||
break;
|
||||
case 24: pix[0] = bytestream2_get_byte(gb);
|
||||
pix[1] = bytestream2_get_byte(gb);
|
||||
pix[2] = bytestream2_get_byte(gb);
|
||||
break;
|
||||
case 32: pix32 = bytestream2_get_le32(gb);
|
||||
break;
|
||||
}
|
||||
if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) ||
|
||||
(pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end))
|
||||
if (output + p1 * (depth >> 3) > output_end)
|
||||
continue;
|
||||
for(i = 0; i < p1; i++) {
|
||||
switch(depth){
|
||||
case 8: *output++ = pix[0];
|
||||
break;
|
||||
case 16: *(uint16_t*)output = pix16;
|
||||
output += 2;
|
||||
break;
|
||||
case 24: *output++ = pix[0];
|
||||
*output++ = pix[1];
|
||||
*output++ = pix[2];
|
||||
break;
|
||||
case 32: *(uint32_t*)output = pix32;
|
||||
output += 4;
|
||||
break;
|
||||
|
||||
switch(depth){
|
||||
case 8:
|
||||
pix[0] = bytestream2_get_byte(gb);
|
||||
for(i = 0; i < p1; i++)
|
||||
*output++ = pix[0];
|
||||
break;
|
||||
case 16:
|
||||
pix16 = bytestream2_get_le16(gb);
|
||||
for(i = 0; i < p1; i++) {
|
||||
*(uint16_t*)output = pix16;
|
||||
output += 2;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
pix[0] = bytestream2_get_byte(gb);
|
||||
pix[1] = bytestream2_get_byte(gb);
|
||||
pix[2] = bytestream2_get_byte(gb);
|
||||
for(i = 0; i < p1; i++) {
|
||||
*output++ = pix[0];
|
||||
*output++ = pix[1];
|
||||
*output++ = pix[2];
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
pix32 = bytestream2_get_le32(gb);
|
||||
for(i = 0; i < p1; i++) {
|
||||
*(uint32_t*)output = pix32;
|
||||
output += 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
pos += p1;
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ static int get_quant(AVCodecContext *avctx, NuvContext *c, const uint8_t *buf,
|
||||
int i;
|
||||
if (size < 2 * 64 * 4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "insufficient rtjpeg quant data\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
for (i = 0; i < 64; i++, buf += 4)
|
||||
c->lq[i] = AV_RL32(buf);
|
||||
@@ -114,6 +114,8 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height,
|
||||
int quality)
|
||||
{
|
||||
NuvContext *c = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
width = FFALIGN(width, 2);
|
||||
height = FFALIGN(height, 2);
|
||||
if (quality >= 0)
|
||||
@@ -121,9 +123,10 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height,
|
||||
if (width != c->width || height != c->height) {
|
||||
// also reserve space for a possible additional header
|
||||
int buf_size = 24 + height * width * 3 / 2 + AV_LZO_OUTPUT_PADDING;
|
||||
if (av_image_check_size(height, width, 0, avctx) < 0 ||
|
||||
buf_size > INT_MAX/8)
|
||||
if (buf_size > INT_MAX/8)
|
||||
return -1;
|
||||
if ((ret = av_image_check_size(height, width, 0, avctx)) < 0)
|
||||
return ret;
|
||||
avctx->width = c->width = width;
|
||||
avctx->height = c->height = height;
|
||||
av_fast_malloc(&c->decomp_buf, &c->decomp_size,
|
||||
@@ -154,6 +157,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int keyframe;
|
||||
int size_change = 0;
|
||||
int result;
|
||||
int ret;
|
||||
enum {
|
||||
NUV_UNCOMPRESSED = '0',
|
||||
NUV_RTJPEG = '1',
|
||||
@@ -165,7 +169,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
|
||||
if (buf_size < 12) {
|
||||
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
// codec data (rtjpeg quant tables)
|
||||
@@ -184,7 +188,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
|
||||
if (buf_size < 12 || buf[0] != 'V') {
|
||||
av_log(avctx, AV_LOG_ERROR, "not a nuv video frame\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
comptype = buf[1];
|
||||
switch (comptype) {
|
||||
@@ -204,11 +208,14 @@ retry:
|
||||
buf = &buf[12];
|
||||
buf_size -= 12;
|
||||
if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
|
||||
int outlen = c->decomp_size - AV_LZO_OUTPUT_PADDING, inlen = buf_size;
|
||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
|
||||
int outlen = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING);
|
||||
int inlen = buf_size;
|
||||
if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
buf = c->decomp_buf;
|
||||
buf_size = c->decomp_size - AV_LZO_OUTPUT_PADDING - outlen;
|
||||
buf_size = c->decomp_size - FFMAX(FF_INPUT_BUFFER_PADDING_SIZE, AV_LZO_OUTPUT_PADDING) - outlen;
|
||||
}
|
||||
if (c->codec_frameheader) {
|
||||
int w, h, q;
|
||||
@@ -227,10 +234,9 @@ retry:
|
||||
w = AV_RL16(&buf[6]);
|
||||
h = AV_RL16(&buf[8]);
|
||||
q = buf[10];
|
||||
res = codec_reinit(avctx, w, h, q);
|
||||
if (res < 0)
|
||||
return res;
|
||||
if (res) {
|
||||
if ((result = codec_reinit(avctx, w, h, q)) < 0)
|
||||
return result;
|
||||
if (result) {
|
||||
buf = avpkt->data;
|
||||
buf_size = avpkt->size;
|
||||
size_change = 1;
|
||||
@@ -248,7 +254,7 @@ retry:
|
||||
result = avctx->reget_buffer(avctx, &c->pic);
|
||||
if (result < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
||||
@@ -268,7 +274,9 @@ retry:
|
||||
}
|
||||
case NUV_RTJPEG_IN_LZO:
|
||||
case NUV_RTJPEG:
|
||||
ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
|
||||
ret = ff_rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
case NUV_BLACK:
|
||||
memset(c->pic.data[0], 0, c->width * c->height);
|
||||
@@ -280,7 +288,7 @@ retry:
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
*picture = c->pic;
|
||||
@@ -291,6 +299,8 @@ retry:
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
NuvContext *c = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
c->pic.data[0] = NULL;
|
||||
c->decomp_buf = NULL;
|
||||
@@ -305,8 +315,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
||||
ff_dsputil_init(&c->dsp, avctx);
|
||||
|
||||
if (codec_reinit(avctx, avctx->width, avctx->height, -1) < 0)
|
||||
return 1;
|
||||
if ((ret = codec_reinit(avctx, avctx->width, avctx->height, -1)) < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -235,8 +235,10 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
|
||||
if(next == END_NOT_FOUND){
|
||||
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
if(!new_buffer)
|
||||
if(!new_buffer) {
|
||||
pc->index = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
pc->buffer = new_buffer;
|
||||
memcpy(&pc->buffer[pc->index], *buf, *buf_size);
|
||||
pc->index += *buf_size;
|
||||
@@ -249,9 +251,11 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
|
||||
/* append to buffer */
|
||||
if(pc->index){
|
||||
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
|
||||
if(!new_buffer)
|
||||
if(!new_buffer) {
|
||||
pc->overread_index =
|
||||
pc->index = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
pc->buffer = new_buffer;
|
||||
if (next > -FF_INPUT_BUFFER_PADDING_SIZE)
|
||||
memcpy(&pc->buffer[pc->index], *buf,
|
||||
|
@@ -311,7 +311,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
|
||||
/* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */
|
||||
samples_per_block = 1;
|
||||
if (AV_CODEC_ID_PCM_DVD == avctx->codec_id) {
|
||||
if (avctx->codec->id == AV_CODEC_ID_PCM_DVD) {
|
||||
if (avctx->bits_per_coded_sample != 20 &&
|
||||
avctx->bits_per_coded_sample != 24) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
|
@@ -42,18 +42,20 @@ static av_cold int pcx_init(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pcx_rle_decode(GetByteContext *gb, uint8_t *dst,
|
||||
unsigned int bytes_per_scanline, int compressed)
|
||||
static void pcx_rle_decode(GetByteContext *gb,
|
||||
uint8_t *dst,
|
||||
unsigned int bytes_per_scanline,
|
||||
int compressed)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
unsigned char run, value;
|
||||
|
||||
if (compressed) {
|
||||
while (i<bytes_per_scanline) {
|
||||
while (i < bytes_per_scanline && bytestream2_get_bytes_left(gb)>0) {
|
||||
run = 1;
|
||||
value = bytestream2_get_byte(gb);
|
||||
if (value >= 0xc0) {
|
||||
run = value & 0x3f;
|
||||
if (value >= 0xc0 && bytestream2_get_bytes_left(gb)>0) {
|
||||
run = value & 0x3f;
|
||||
value = bytestream2_get_byte(gb);
|
||||
}
|
||||
while (i<bytes_per_scanline && run--)
|
||||
@@ -119,7 +121,8 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
bytes_per_line = bytestream2_get_le16u(&gb);
|
||||
bytes_per_scanline = nplanes * bytes_per_line;
|
||||
|
||||
if (bytes_per_scanline < w * bits_per_pixel * nplanes / 8) {
|
||||
if (bytes_per_scanline < (w * bits_per_pixel * nplanes + 7) / 8 ||
|
||||
(!compressed && bytes_per_scanline > bytestream2_get_bytes_left(&gb) / h)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "PCX data is corrupted\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -181,7 +184,13 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
} else if (nplanes == 1 && bits_per_pixel == 8) {
|
||||
int palstart = avpkt->size - 769;
|
||||
|
||||
for (y=0; y<h; y++, ptr+=stride) {
|
||||
if (avpkt->size < 769) {
|
||||
av_log(avctx, AV_LOG_ERROR, "File is too short\n");
|
||||
ret = avpkt->size;
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (y = 0; y < h; y++, ptr += stride) {
|
||||
pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed);
|
||||
memcpy(ptr, scanline, w);
|
||||
}
|
||||
@@ -192,7 +201,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
}
|
||||
if (bytestream2_get_byte(&gb) != 12) {
|
||||
av_log(avctx, AV_LOG_ERROR, "expected palette after image data\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
ret = avpkt->size;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@@ -237,6 +237,8 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
|
||||
if (bits_per_plane == 8) {
|
||||
picmemset_8bpp(s, val, run, &x, &y);
|
||||
if (y < 0)
|
||||
goto finish;
|
||||
} else {
|
||||
picmemset(s, val, run, &x, &y, &plane, bits_per_plane);
|
||||
}
|
||||
@@ -257,6 +259,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
y--;
|
||||
}
|
||||
}
|
||||
finish:
|
||||
|
||||
*got_frame = 1;
|
||||
*(AVFrame*)data = s->frame;
|
||||
|
@@ -38,9 +38,7 @@ static const uint8_t ff_png_pass_xshift[NB_PASSES] = {
|
||||
|
||||
void *ff_png_zalloc(void *opaque, unsigned int items, unsigned int size)
|
||||
{
|
||||
if(items >= UINT_MAX / size)
|
||||
return NULL;
|
||||
return av_malloc(items * size);
|
||||
return av_mallocz_array(items, size);
|
||||
}
|
||||
|
||||
void ff_png_zfree(void *opaque, void *ptr)
|
||||
|
@@ -189,7 +189,7 @@ void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w
|
||||
if(bpp >= 2) g = dst[1];\
|
||||
if(bpp >= 3) b = dst[2];\
|
||||
if(bpp >= 4) a = dst[3];\
|
||||
for(; i < size; i+=bpp) {\
|
||||
for(; i <= size - bpp; i+=bpp) {\
|
||||
dst[i+0] = r = op(r, src[i+0], last[i+0]);\
|
||||
if(bpp == 1) continue;\
|
||||
dst[i+1] = g = op(g, src[i+1], last[i+1]);\
|
||||
@@ -205,13 +205,9 @@ void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w
|
||||
else if(bpp == 2) UNROLL1(2, op)\
|
||||
else if(bpp == 3) UNROLL1(3, op)\
|
||||
else if(bpp == 4) UNROLL1(4, op)\
|
||||
else {\
|
||||
for (; i < size; i += bpp) {\
|
||||
int j;\
|
||||
for (j = 0; j < bpp; j++)\
|
||||
dst[i+j] = op(dst[i+j-bpp], src[i+j], last[i+j]);\
|
||||
}\
|
||||
}
|
||||
for (; i < size; i++) {\
|
||||
dst[i] = op(dst[i-bpp], src[i], last[i]);\
|
||||
}\
|
||||
|
||||
/* NOTE: 'dst' can be equal to 'last' */
|
||||
static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
|
||||
@@ -384,6 +380,10 @@ static int png_decode_idat(PNGDecContext *s, int length)
|
||||
s->zstream.avail_out = s->crow_size;
|
||||
s->zstream.next_out = s->crow_buf;
|
||||
}
|
||||
if (ret == Z_STREAM_END && s->zstream.avail_in > 0) {
|
||||
av_log(NULL, AV_LOG_WARNING, "%d undecompressed bytes left in buffer\n", s->zstream.avail_in);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user