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
057dce5f
Commit
057dce5f
authored
Aug 30, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kgv1dec: make decoder independent of sizeof(AVFrame)
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
ea3ce008
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
kgv1dec.c
libavcodec/kgv1dec.c
+13
-8
No files found.
libavcodec/kgv1dec.c
View file @
057dce5f
...
@@ -32,14 +32,14 @@
...
@@ -32,14 +32,14 @@
typedef
struct
{
typedef
struct
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
prev
;
AVFrame
*
prev
;
}
KgvContext
;
}
KgvContext
;
static
void
decode_flush
(
AVCodecContext
*
avctx
)
static
void
decode_flush
(
AVCodecContext
*
avctx
)
{
{
KgvContext
*
const
c
=
avctx
->
priv_data
;
KgvContext
*
const
c
=
avctx
->
priv_data
;
av_frame_unref
(
&
c
->
prev
);
av_frame_unref
(
c
->
prev
);
}
}
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
static
int
decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame
,
...
@@ -65,7 +65,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -65,7 +65,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return
res
;
return
res
;
if
(
w
!=
avctx
->
width
||
h
!=
avctx
->
height
)
{
if
(
w
!=
avctx
->
width
||
h
!=
avctx
->
height
)
{
av_frame_unref
(
&
c
->
prev
);
av_frame_unref
(
c
->
prev
);
avcodec_set_dimensions
(
avctx
,
w
,
h
);
avcodec_set_dimensions
(
avctx
,
w
,
h
);
}
}
...
@@ -74,8 +74,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -74,8 +74,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
((
res
=
ff_get_buffer
(
avctx
,
frame
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
if
((
res
=
ff_get_buffer
(
avctx
,
frame
,
AV_GET_BUFFER_FLAG_REF
))
<
0
)
return
res
;
return
res
;
out
=
frame
->
data
[
0
];
out
=
frame
->
data
[
0
];
if
(
c
->
prev
.
data
[
0
])
{
if
(
c
->
prev
->
data
[
0
])
{
prev
=
c
->
prev
.
data
[
0
];
prev
=
c
->
prev
->
data
[
0
];
}
else
{
}
else
{
prev
=
NULL
;
prev
=
NULL
;
}
}
...
@@ -145,8 +145,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -145,8 +145,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
(
outcnt
-
maxcnt
)
if
(
outcnt
-
maxcnt
)
av_log
(
avctx
,
AV_LOG_DEBUG
,
"frame finished with %d diff
\n
"
,
outcnt
-
maxcnt
);
av_log
(
avctx
,
AV_LOG_DEBUG
,
"frame finished with %d diff
\n
"
,
outcnt
-
maxcnt
);
av_frame_unref
(
&
c
->
prev
);
av_frame_unref
(
c
->
prev
);
if
((
res
=
av_frame_ref
(
&
c
->
prev
,
frame
))
<
0
)
if
((
res
=
av_frame_ref
(
c
->
prev
,
frame
))
<
0
)
return
res
;
return
res
;
*
got_frame
=
1
;
*
got_frame
=
1
;
...
@@ -162,12 +162,17 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -162,12 +162,17 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB555
;
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB555
;
avctx
->
flags
|=
CODEC_FLAG_EMU_EDGE
;
avctx
->
flags
|=
CODEC_FLAG_EMU_EDGE
;
c
->
prev
=
av_frame_alloc
();
if
(
!
c
->
prev
)
return
AVERROR
(
ENOMEM
);
return
0
;
return
0
;
}
}
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
static
av_cold
int
decode_end
(
AVCodecContext
*
avctx
)
{
{
decode_flush
(
avctx
);
KgvContext
*
const
c
=
avctx
->
priv_data
;
av_frame_free
(
&
c
->
prev
);
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