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
02fe531a
Commit
02fe531a
authored
Jul 29, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mss2: make code independent of sizeof(AVFrame)
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
451b2ca1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
mss2.c
libavcodec/mss2.c
+14
-13
No files found.
libavcodec/mss2.c
View file @
02fe531a
...
...
@@ -34,7 +34,7 @@
typedef
struct
MSS2Context
{
VC1Context
v
;
int
split_position
;
AVFrame
last_pic
;
AVFrame
*
last_pic
;
MSS12Context
c
;
MSS2DSPContext
dsp
;
SliceContext
sc
[
2
];
...
...
@@ -523,8 +523,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return
AVERROR_INVALIDDATA
;
avctx
->
pix_fmt
=
is_555
?
AV_PIX_FMT_RGB555
:
AV_PIX_FMT_RGB24
;
if
(
ctx
->
last_pic
.
format
!=
avctx
->
pix_fmt
)
av_frame_unref
(
&
ctx
->
last_pic
);
if
(
ctx
->
last_pic
->
format
!=
avctx
->
pix_fmt
)
av_frame_unref
(
ctx
->
last_pic
);
if
(
has_wmv9
)
{
bytestream2_init
(
&
gB
,
buf
,
buf_size
+
ARITH2_PADDING
);
...
...
@@ -601,18 +601,18 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
return
ret
;
if
(
ctx
->
last_pic
.
data
[
0
])
{
av_assert0
(
frame
->
linesize
[
0
]
==
ctx
->
last_pic
.
linesize
[
0
]);
c
->
last_rgb_pic
=
ctx
->
last_pic
.
data
[
0
]
+
ctx
->
last_pic
.
linesize
[
0
]
*
(
avctx
->
height
-
1
);
if
(
ctx
->
last_pic
->
data
[
0
])
{
av_assert0
(
frame
->
linesize
[
0
]
==
ctx
->
last_pic
->
linesize
[
0
]);
c
->
last_rgb_pic
=
ctx
->
last_pic
->
data
[
0
]
+
ctx
->
last_pic
->
linesize
[
0
]
*
(
avctx
->
height
-
1
);
}
else
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Missing keyframe
\n
"
);
return
AVERROR_INVALIDDATA
;
}
}
else
{
if
((
ret
=
ff_reget_buffer
(
avctx
,
&
ctx
->
last_pic
))
<
0
)
if
((
ret
=
ff_reget_buffer
(
avctx
,
ctx
->
last_pic
))
<
0
)
return
ret
;
if
((
ret
=
av_frame_ref
(
frame
,
&
ctx
->
last_pic
))
<
0
)
if
((
ret
=
av_frame_ref
(
frame
,
ctx
->
last_pic
))
<
0
)
return
ret
;
c
->
last_rgb_pic
=
NULL
;
...
...
@@ -726,8 +726,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
av_log
(
avctx
,
AV_LOG_WARNING
,
"buffer not fully consumed
\n
"
);
if
(
c
->
mvX
<
0
||
c
->
mvY
<
0
)
{
av_frame_unref
(
&
ctx
->
last_pic
);
ret
=
av_frame_ref
(
&
ctx
->
last_pic
,
frame
);
av_frame_unref
(
ctx
->
last_pic
);
ret
=
av_frame_ref
(
ctx
->
last_pic
,
frame
);
if
(
ret
<
0
)
return
ret
;
}
...
...
@@ -802,7 +802,7 @@ static av_cold int mss2_decode_end(AVCodecContext *avctx)
{
MSS2Context
*
const
ctx
=
avctx
->
priv_data
;
av_frame_
unref
(
&
ctx
->
last_pic
);
av_frame_
free
(
&
ctx
->
last_pic
);
ff_mss12_decode_end
(
&
ctx
->
c
);
av_freep
(
&
ctx
->
c
.
pal_pic
);
...
...
@@ -820,10 +820,11 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx)
c
->
avctx
=
avctx
;
if
(
ret
=
ff_mss12_decode_init
(
c
,
1
,
&
ctx
->
sc
[
0
],
&
ctx
->
sc
[
1
]))
return
ret
;
ctx
->
last_pic
=
av_frame_alloc
();
c
->
pal_stride
=
c
->
mask_stride
;
c
->
pal_pic
=
av_mallocz
(
c
->
pal_stride
*
avctx
->
height
);
c
->
last_pal_pic
=
av_mallocz
(
c
->
pal_stride
*
avctx
->
height
);
if
(
!
c
->
pal_pic
||
!
c
->
last_pal_pic
)
{
if
(
!
c
->
pal_pic
||
!
c
->
last_pal_pic
||
!
ctx
->
last_pic
)
{
mss2_decode_end
(
avctx
);
return
AVERROR
(
ENOMEM
);
}
...
...
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