Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
044f7275
Commit
044f7275
authored
Apr 20, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffv1: add optional per slice CRCs to detect undamaged slices.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
b4fc5385
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
ffv1.c
libavcodec/ffv1.c
+22
-1
No files found.
libavcodec/ffv1.c
View file @
044f7275
...
...
@@ -192,6 +192,7 @@ typedef struct FFV1Context{
int16_t
*
sample_buffer
;
int
gob_count
;
int
packed_at_lsb
;
int
ec
;
int
quant_table_count
;
...
...
@@ -833,6 +834,10 @@ static int write_extra_header(FFV1Context *f){
}
}
if
(
f
->
version
>
2
){
put_symbol
(
c
,
state
,
f
->
ec
,
0
);
}
f
->
avctx
->
extradata_size
=
ff_rac_terminate
(
c
);
v
=
av_crc
(
av_crc_get_table
(
AV_CRC_32_IEEE
),
0
,
f
->
avctx
->
extradata
,
f
->
avctx
->
extradata_size
);
AV_WL32
(
f
->
avctx
->
extradata
+
f
->
avctx
->
extradata_size
,
v
);
...
...
@@ -1290,6 +1295,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
AV_WB24
(
buf_p
+
bytes
,
bytes
);
bytes
+=
3
;
}
if
(
f
->
ec
){
unsigned
v
=
av_crc
(
av_crc_get_table
(
AV_CRC_32_IEEE
),
0
,
buf_p
,
bytes
);
AV_WL32
(
buf_p
+
bytes
,
v
);
bytes
+=
4
;
}
buf_p
+=
bytes
;
}
...
...
@@ -1726,6 +1735,10 @@ static int read_extra_header(FFV1Context *f){
}
}
if
(
f
->
version
>
2
){
f
->
ec
=
get_symbol
(
c
,
state
,
0
);
}
if
(
f
->
version
>
2
){
unsigned
v
;
v
=
av_crc
(
av_crc_get_table
(
AV_CRC_32_IEEE
),
0
,
f
->
avctx
->
extradata
,
f
->
avctx
->
extradata_size
);
...
...
@@ -1959,9 +1972,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
buf_p
=
buf
+
buf_size
;
for
(
i
=
f
->
slice_count
-
1
;
i
>=
0
;
i
--
){
FFV1Context
*
fs
=
f
->
slice_context
[
i
];
int
trailer
=
3
+
4
*!!
f
->
ec
;
int
v
;
if
(
i
)
v
=
AV_RB24
(
buf_p
-
3
)
+
3
;
if
(
i
)
v
=
AV_RB24
(
buf_p
-
trailer
)
+
trailer
;
else
v
=
buf_p
-
c
->
bytestream_start
;
if
(
buf_p
-
c
->
bytestream_start
<
v
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"Slice pointer chain broken
\n
"
);
...
...
@@ -1969,6 +1983,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
}
buf_p
-=
v
;
if
(
f
->
ec
){
unsigned
crc
=
av_crc
(
av_crc_get_table
(
AV_CRC_32_IEEE
),
0
,
buf_p
,
v
);
if
(
crc
){
av_log
(
f
->
avctx
,
AV_LOG_ERROR
,
"CRC mismatch %X!
\n
"
,
crc
);
}
}
if
(
i
){
if
(
fs
->
ac
){
ff_init_range_decoder
(
&
fs
->
c
,
buf_p
,
v
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment