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
e8ef8a32
Commit
e8ef8a32
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpza: use the AVFrame API properly.
parent
e52f38bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
rpza.c
libavcodec/rpza.c
+9
-7
No files found.
libavcodec/rpza.c
View file @
e8ef8a32
...
...
@@ -46,7 +46,7 @@
typedef
struct
RpzaContext
{
AVCodecContext
*
avctx
;
AVFrame
frame
;
AVFrame
*
frame
;
const
unsigned
char
*
buf
;
int
size
;
...
...
@@ -72,7 +72,7 @@ typedef struct RpzaContext {
static
void
rpza_decode_stream
(
RpzaContext
*
s
)
{
int
width
=
s
->
avctx
->
width
;
int
stride
=
s
->
frame
.
linesize
[
0
]
/
2
;
int
stride
=
s
->
frame
->
linesize
[
0
]
/
2
;
int
row_inc
=
stride
-
4
;
int
stream_ptr
=
0
;
int
chunk_size
;
...
...
@@ -82,7 +82,7 @@ static void rpza_decode_stream(RpzaContext *s)
unsigned
short
color4
[
4
];
unsigned
char
index
,
idx
;
unsigned
short
ta
,
tb
;
unsigned
short
*
pixels
=
(
unsigned
short
*
)
s
->
frame
.
data
[
0
];
unsigned
short
*
pixels
=
(
unsigned
short
*
)
s
->
frame
->
data
[
0
];
int
row_ptr
=
0
;
int
pixel_ptr
=
0
;
...
...
@@ -239,7 +239,9 @@ static av_cold int rpza_decode_init(AVCodecContext *avctx)
s
->
avctx
=
avctx
;
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB555
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
s
->
frame
=
av_frame_alloc
();
if
(
!
s
->
frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
}
...
...
@@ -256,14 +258,14 @@ static int rpza_decode_frame(AVCodecContext *avctx,
s
->
buf
=
buf
;
s
->
size
=
buf_size
;
if
((
ret
=
ff_reget_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
if
((
ret
=
ff_reget_buffer
(
avctx
,
s
->
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
ret
;
}
rpza_decode_stream
(
s
);
if
((
ret
=
av_frame_ref
(
data
,
&
s
->
frame
))
<
0
)
if
((
ret
=
av_frame_ref
(
data
,
s
->
frame
))
<
0
)
return
ret
;
*
got_frame
=
1
;
...
...
@@ -276,7 +278,7 @@ static av_cold int rpza_decode_end(AVCodecContext *avctx)
{
RpzaContext
*
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