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
1557f34b
Commit
1557f34b
authored
Apr 15, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dfa: support decoding version=1.0
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
1cb02d4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
dfa.c
libavcodec/dfa.c
+11
-2
dfa.c
libavformat/dfa.c
+9
-1
No files found.
libavcodec/dfa.c
View file @
1557f34b
...
@@ -340,6 +340,7 @@ static int dfa_decode_frame(AVCodecContext *avctx,
...
@@ -340,6 +340,7 @@ static int dfa_decode_frame(AVCodecContext *avctx,
uint8_t
*
dst
;
uint8_t
*
dst
;
int
ret
;
int
ret
;
int
i
,
pal_elems
;
int
i
,
pal_elems
;
int
version
=
avctx
->
extradata_size
==
2
?
AV_RL16
(
avctx
->
extradata
)
:
0
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
0
))
<
0
)
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
0
))
<
0
)
return
ret
;
return
ret
;
...
@@ -374,10 +375,18 @@ static int dfa_decode_frame(AVCodecContext *avctx,
...
@@ -374,10 +375,18 @@ static int dfa_decode_frame(AVCodecContext *avctx,
buf
=
s
->
frame_buf
;
buf
=
s
->
frame_buf
;
dst
=
frame
->
data
[
0
];
dst
=
frame
->
data
[
0
];
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
for
(
i
=
0
;
i
<
avctx
->
height
;
i
++
)
{
if
(
version
==
0x100
)
{
int
j
;
for
(
j
=
0
;
j
<
avctx
->
width
;
j
++
)
{
dst
[
j
]
=
buf
[
(
i
&
3
)
*
(
avctx
->
width
/
4
)
+
(
j
/
4
)
+
((
j
&
3
)
*
(
avctx
->
height
/
4
)
+
(
i
/
4
))
*
avctx
->
width
];
}
}
else
{
memcpy
(
dst
,
buf
,
avctx
->
width
);
memcpy
(
dst
,
buf
,
avctx
->
width
);
dst
+=
frame
->
linesize
[
0
];
buf
+=
avctx
->
width
;
buf
+=
avctx
->
width
;
}
}
dst
+=
frame
->
linesize
[
0
];
}
memcpy
(
frame
->
data
[
1
],
s
->
pal
,
sizeof
(
s
->
pal
));
memcpy
(
frame
->
data
[
1
],
s
->
pal
,
sizeof
(
s
->
pal
));
*
got_frame
=
1
;
*
got_frame
=
1
;
...
...
libavformat/dfa.c
View file @
1557f34b
...
@@ -36,13 +36,15 @@ static int dfa_read_header(AVFormatContext *s)
...
@@ -36,13 +36,15 @@ static int dfa_read_header(AVFormatContext *s)
AVIOContext
*
pb
=
s
->
pb
;
AVIOContext
*
pb
=
s
->
pb
;
AVStream
*
st
;
AVStream
*
st
;
int
frames
;
int
frames
;
int
version
;
uint32_t
mspf
;
uint32_t
mspf
;
if
(
avio_rl32
(
pb
)
!=
MKTAG
(
'D'
,
'F'
,
'I'
,
'A'
))
{
if
(
avio_rl32
(
pb
)
!=
MKTAG
(
'D'
,
'F'
,
'I'
,
'A'
))
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid magic for DFA
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid magic for DFA
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
avio_skip
(
pb
,
2
);
// unused
version
=
avio_rl16
(
pb
);
frames
=
avio_rl16
(
pb
);
frames
=
avio_rl16
(
pb
);
st
=
avformat_new_stream
(
s
,
NULL
);
st
=
avformat_new_stream
(
s
,
NULL
);
...
@@ -62,6 +64,12 @@ static int dfa_read_header(AVFormatContext *s)
...
@@ -62,6 +64,12 @@ static int dfa_read_header(AVFormatContext *s)
avio_skip
(
pb
,
128
-
16
);
// padding
avio_skip
(
pb
,
128
-
16
);
// padding
st
->
duration
=
frames
;
st
->
duration
=
frames
;
st
->
codec
->
extradata
=
av_malloc
(
2
);
st
->
codec
->
extradata_size
=
2
;
AV_WL16
(
st
->
codec
->
extradata
,
version
);
if
(
version
==
0x100
)
st
->
sample_aspect_ratio
=
(
AVRational
){
2
,
1
};
return
0
;
return
0
;
}
}
...
...
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