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
e999f233
Commit
e999f233
authored
Jul 26, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
truemotion2: make code independent of sizeof(AVFrame)
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
a5155294
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
truemotion2.c
libavcodec/truemotion2.c
+8
-6
No files found.
libavcodec/truemotion2.c
View file @
e999f233
...
@@ -58,7 +58,7 @@ enum TM2_BLOCKS {
...
@@ -58,7 +58,7 @@ enum TM2_BLOCKS {
typedef
struct
TM2Context
{
typedef
struct
TM2Context
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
pic
;
AVFrame
*
pic
;
GetBitContext
gb
;
GetBitContext
gb
;
DSPContext
dsp
;
DSPContext
dsp
;
...
@@ -858,7 +858,7 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -858,7 +858,7 @@ static int decode_frame(AVCodecContext *avctx,
TM2Context
*
const
l
=
avctx
->
priv_data
;
TM2Context
*
const
l
=
avctx
->
priv_data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
&
~
3
;
int
buf_size
=
avpkt
->
size
&
~
3
;
AVFrame
*
const
p
=
&
l
->
pic
;
AVFrame
*
const
p
=
l
->
pic
;
int
offset
=
TM2_HEADER_SIZE
;
int
offset
=
TM2_HEADER_SIZE
;
int
i
,
t
,
ret
;
int
i
,
t
,
ret
;
...
@@ -900,7 +900,7 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -900,7 +900,7 @@ static int decode_frame(AVCodecContext *avctx,
l
->
cur
=
!
l
->
cur
;
l
->
cur
=
!
l
->
cur
;
*
got_frame
=
1
;
*
got_frame
=
1
;
ret
=
av_frame_ref
(
data
,
&
l
->
pic
);
ret
=
av_frame_ref
(
data
,
l
->
pic
);
return
(
ret
<
0
)
?
ret
:
buf_size
;
return
(
ret
<
0
)
?
ret
:
buf_size
;
}
}
...
@@ -916,8 +916,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -916,8 +916,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
}
l
->
avctx
=
avctx
;
l
->
avctx
=
avctx
;
avcodec_get_frame_defaults
(
&
l
->
pic
);
avctx
->
pix_fmt
=
AV_PIX_FMT_BGR24
;
avctx
->
pix_fmt
=
AV_PIX_FMT_BGR24
;
l
->
pic
=
av_frame_alloc
();
if
(
!
l
->
pic
)
return
AVERROR
(
ENOMEM
);
ff_dsputil_init
(
&
l
->
dsp
,
avctx
);
ff_dsputil_init
(
&
l
->
dsp
,
avctx
);
...
@@ -953,6 +955,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -953,6 +955,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_freep
(
l
->
V2_base
);
av_freep
(
l
->
V2_base
);
av_freep
(
l
->
last
);
av_freep
(
l
->
last
);
av_freep
(
l
->
clast
);
av_freep
(
l
->
clast
);
av_frame_free
(
&
l
->
pic
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
l
->
Y1
=
l
->
Y1_base
+
l
->
y_stride
*
4
+
4
;
l
->
Y1
=
l
->
Y1_base
+
l
->
y_stride
*
4
+
4
;
...
@@ -968,7 +971,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -968,7 +971,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
{
{
TM2Context
*
const
l
=
avctx
->
priv_data
;
TM2Context
*
const
l
=
avctx
->
priv_data
;
AVFrame
*
pic
=
&
l
->
pic
;
int
i
;
int
i
;
av_free
(
l
->
last
);
av_free
(
l
->
last
);
...
@@ -986,7 +988,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
...
@@ -986,7 +988,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
av_freep
(
&
l
->
buffer
);
av_freep
(
&
l
->
buffer
);
l
->
buffer_size
=
0
;
l
->
buffer_size
=
0
;
av_frame_
unref
(
pic
);
av_frame_
free
(
&
l
->
pic
);
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