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
678431d3
Commit
678431d3
authored
Jul 31, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jv: make code independent of sizeof(AVFrame)
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
ff1c13b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
jvdec.c
libavcodec/jvdec.c
+14
-12
No files found.
libavcodec/jvdec.c
View file @
678431d3
...
...
@@ -33,7 +33,7 @@
typedef
struct
JvContext
{
DSPContext
dsp
;
AVFrame
frame
;
AVFrame
*
frame
;
uint32_t
palette
[
AVPALETTE_COUNT
];
int
palette_has_changed
;
}
JvContext
;
...
...
@@ -43,7 +43,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
JvContext
*
s
=
avctx
->
priv_data
;
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
ff_dsputil_init
(
&
s
->
dsp
,
avctx
);
avcodec_get_frame_defaults
(
&
s
->
frame
);
s
->
frame
=
av_frame_alloc
();
if
(
!
s
->
frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
}
...
...
@@ -151,7 +153,7 @@ static int decode_frame(AVCodecContext *avctx,
av_log
(
avctx
,
AV_LOG_ERROR
,
"video size %d invalid
\n
"
,
video_size
);
return
AVERROR_INVALIDDATA
;
}
if
((
ret
=
ff_reget_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
if
((
ret
=
ff_reget_buffer
(
avctx
,
s
->
frame
))
<
0
)
return
ret
;
if
(
video_type
==
0
||
video_type
==
1
)
{
...
...
@@ -160,14 +162,14 @@ static int decode_frame(AVCodecContext *avctx,
for
(
j
=
0
;
j
<
avctx
->
height
;
j
+=
8
)
for
(
i
=
0
;
i
<
avctx
->
width
;
i
+=
8
)
decode8x8
(
&
gb
,
s
->
frame
.
data
[
0
]
+
j
*
s
->
frame
.
linesize
[
0
]
+
i
,
s
->
frame
.
linesize
[
0
],
&
s
->
dsp
);
decode8x8
(
&
gb
,
s
->
frame
->
data
[
0
]
+
j
*
s
->
frame
->
linesize
[
0
]
+
i
,
s
->
frame
->
linesize
[
0
],
&
s
->
dsp
);
buf
+=
video_size
;
}
else
if
(
video_type
==
2
)
{
int
v
=
*
buf
++
;
for
(
j
=
0
;
j
<
avctx
->
height
;
j
++
)
memset
(
s
->
frame
.
data
[
0
]
+
j
*
s
->
frame
.
linesize
[
0
],
v
,
avctx
->
width
);
memset
(
s
->
frame
->
data
[
0
]
+
j
*
s
->
frame
->
linesize
[
0
],
v
,
avctx
->
width
);
}
else
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"unsupported frame type %i
\n
"
,
video_type
);
return
AVERROR_INVALIDDATA
;
...
...
@@ -184,13 +186,13 @@ static int decode_frame(AVCodecContext *avctx,
}
if
(
video_size
)
{
s
->
frame
.
key_frame
=
1
;
s
->
frame
.
pict_type
=
AV_PICTURE_TYPE_I
;
s
->
frame
.
palette_has_changed
=
s
->
palette_has_changed
;
s
->
frame
->
key_frame
=
1
;
s
->
frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
s
->
frame
->
palette_has_changed
=
s
->
palette_has_changed
;
s
->
palette_has_changed
=
0
;
memcpy
(
s
->
frame
.
data
[
1
],
s
->
palette
,
AVPALETTE_SIZE
);
memcpy
(
s
->
frame
->
data
[
1
],
s
->
palette
,
AVPALETTE_SIZE
);
if
((
ret
=
av_frame_ref
(
data
,
&
s
->
frame
))
<
0
)
if
((
ret
=
av_frame_ref
(
data
,
s
->
frame
))
<
0
)
return
ret
;
*
got_frame
=
1
;
}
...
...
@@ -202,7 +204,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
{
JvContext
*
s
=
avctx
->
priv_data
;
av_frame_
unref
(
&
s
->
frame
);
av_frame_
free
(
&
s
->
frame
);
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