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
ff1c13b1
Commit
ff1c13b1
authored
Jul 29, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mss3: make code independent of sizeof(AVFrame)
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
02fe531a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
mss3.c
libavcodec/mss3.c
+21
-17
No files found.
libavcodec/mss3.c
View file @
ff1c13b1
...
...
@@ -108,7 +108,7 @@ typedef struct HaarBlockCoder {
typedef
struct
MSS3Context
{
AVCodecContext
*
avctx
;
AVFrame
pic
;
AVFrame
*
pic
;
int
got_error
;
RangeCoder
coder
;
...
...
@@ -731,12 +731,12 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return
buf_size
;
c
->
got_error
=
0
;
if
((
ret
=
ff_reget_buffer
(
avctx
,
&
c
->
pic
))
<
0
)
if
((
ret
=
ff_reget_buffer
(
avctx
,
c
->
pic
))
<
0
)
return
ret
;
c
->
pic
.
key_frame
=
keyframe
;
c
->
pic
.
pict_type
=
keyframe
?
AV_PICTURE_TYPE_I
:
AV_PICTURE_TYPE_P
;
c
->
pic
->
key_frame
=
keyframe
;
c
->
pic
->
pict_type
=
keyframe
?
AV_PICTURE_TYPE_I
:
AV_PICTURE_TYPE_P
;
if
(
!
bytestream2_get_bytes_left
(
&
gb
))
{
if
((
ret
=
av_frame_ref
(
data
,
&
c
->
pic
))
<
0
)
if
((
ret
=
av_frame_ref
(
data
,
c
->
pic
))
<
0
)
return
ret
;
*
got_frame
=
1
;
...
...
@@ -749,9 +749,9 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
mb_width
=
dec_width
>>
4
;
mb_height
=
dec_height
>>
4
;
dst
[
0
]
=
c
->
pic
.
data
[
0
]
+
dec_x
+
dec_y
*
c
->
pic
.
linesize
[
0
];
dst
[
1
]
=
c
->
pic
.
data
[
1
]
+
dec_x
/
2
+
(
dec_y
/
2
)
*
c
->
pic
.
linesize
[
1
];
dst
[
2
]
=
c
->
pic
.
data
[
2
]
+
dec_x
/
2
+
(
dec_y
/
2
)
*
c
->
pic
.
linesize
[
2
];
dst
[
0
]
=
c
->
pic
->
data
[
0
]
+
dec_x
+
dec_y
*
c
->
pic
->
linesize
[
0
];
dst
[
1
]
=
c
->
pic
->
data
[
1
]
+
dec_x
/
2
+
(
dec_y
/
2
)
*
c
->
pic
->
linesize
[
1
];
dst
[
2
]
=
c
->
pic
->
data
[
2
]
+
dec_x
/
2
+
(
dec_y
/
2
)
*
c
->
pic
->
linesize
[
2
];
for
(
y
=
0
;
y
<
mb_height
;
y
++
)
{
for
(
x
=
0
;
x
<
mb_width
;
x
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -762,23 +762,23 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
case
FILL_BLOCK
:
decode_fill_block
(
acoder
,
c
->
fill_coder
+
i
,
dst
[
i
]
+
x
*
blk_size
,
c
->
pic
.
linesize
[
i
],
blk_size
);
c
->
pic
->
linesize
[
i
],
blk_size
);
break
;
case
IMAGE_BLOCK
:
decode_image_block
(
acoder
,
c
->
image_coder
+
i
,
dst
[
i
]
+
x
*
blk_size
,
c
->
pic
.
linesize
[
i
],
blk_size
);
c
->
pic
->
linesize
[
i
],
blk_size
);
break
;
case
DCT_BLOCK
:
decode_dct_block
(
acoder
,
c
->
dct_coder
+
i
,
dst
[
i
]
+
x
*
blk_size
,
c
->
pic
.
linesize
[
i
],
blk_size
,
c
->
pic
->
linesize
[
i
],
blk_size
,
c
->
dctblock
,
x
,
y
);
break
;
case
HAAR_BLOCK
:
decode_haar_block
(
acoder
,
c
->
haar_coder
+
i
,
dst
[
i
]
+
x
*
blk_size
,
c
->
pic
.
linesize
[
i
],
blk_size
,
c
->
pic
->
linesize
[
i
],
blk_size
,
c
->
hblock
);
break
;
}
...
...
@@ -790,12 +790,12 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
}
}
}
dst
[
0
]
+=
c
->
pic
.
linesize
[
0
]
*
16
;
dst
[
1
]
+=
c
->
pic
.
linesize
[
1
]
*
8
;
dst
[
2
]
+=
c
->
pic
.
linesize
[
2
]
*
8
;
dst
[
0
]
+=
c
->
pic
->
linesize
[
0
]
*
16
;
dst
[
1
]
+=
c
->
pic
->
linesize
[
1
]
*
8
;
dst
[
2
]
+=
c
->
pic
->
linesize
[
2
]
*
8
;
}
if
((
ret
=
av_frame_ref
(
data
,
&
c
->
pic
))
<
0
)
if
((
ret
=
av_frame_ref
(
data
,
c
->
pic
))
<
0
)
return
ret
;
*
got_frame
=
1
;
...
...
@@ -809,6 +809,9 @@ static av_cold int mss3_decode_init(AVCodecContext *avctx)
int
i
;
c
->
avctx
=
avctx
;
c
->
pic
=
av_frame_alloc
();
if
(
!
c
->
pic
)
return
AVERROR
(
ENOMEM
);
if
((
avctx
->
width
&
0xF
)
||
(
avctx
->
height
&
0xF
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
...
...
@@ -826,6 +829,7 @@ static av_cold int mss3_decode_init(AVCodecContext *avctx)
b_width
*
b_height
);
if
(
!
c
->
dct_coder
[
i
].
prev_dc
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot allocate buffer
\n
"
);
av_frame_free
(
&
c
->
pic
);
while
(
i
>=
0
)
{
av_freep
(
&
c
->
dct_coder
[
i
].
prev_dc
);
i
--
;
...
...
@@ -846,7 +850,7 @@ static av_cold int mss3_decode_end(AVCodecContext *avctx)
MSS3Context
*
const
c
=
avctx
->
priv_data
;
int
i
;
av_frame_
unref
(
&
c
->
pic
);
av_frame_
free
(
&
c
->
pic
);
for
(
i
=
0
;
i
<
3
;
i
++
)
av_freep
(
&
c
->
dct_coder
[
i
].
prev_dc
);
...
...
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