Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
19436308
Commit
19436308
authored
11 years ago
by
Paul B Mahol
Browse files
Options
Downloads
Patches
Plain Diff
dxa: make code independent of sizeof(AVFrame)
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
be256141
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/dxa.c
+13
-10
13 additions, 10 deletions
libavcodec/dxa.c
with
13 additions
and
10 deletions
libavcodec/dxa.c
+
13
−
10
View file @
19436308
...
...
@@ -39,7 +39,7 @@
* Decoder context
*/
typedef
struct
DxaDecContext
{
AVFrame
prev
;
AVFrame
*
prev
;
int
dsize
;
uint8_t
*
decomp_buf
;
...
...
@@ -229,7 +229,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
outptr
=
frame
->
data
[
0
];
srcptr
=
c
->
decomp_buf
;
tmpptr
=
c
->
prev
.
data
[
0
];
tmpptr
=
c
->
prev
->
data
[
0
];
stride
=
frame
->
linesize
[
0
];
if
(
bytestream2_get_le32
(
&
gb
)
==
MKTAG
(
'N'
,
'U'
,
'L'
,
'L'
))
...
...
@@ -250,8 +250,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
case
-
1
:
frame
->
key_frame
=
0
;
frame
->
pict_type
=
AV_PICTURE_TYPE_P
;
if
(
c
->
prev
.
data
[
0
])
memcpy
(
frame
->
data
[
0
],
c
->
prev
.
data
[
0
],
frame
->
linesize
[
0
]
*
avctx
->
height
);
if
(
c
->
prev
->
data
[
0
])
memcpy
(
frame
->
data
[
0
],
c
->
prev
->
data
[
0
],
frame
->
linesize
[
0
]
*
avctx
->
height
);
else
{
// Should happen only when first frame is 'NULL'
memset
(
frame
->
data
[
0
],
0
,
frame
->
linesize
[
0
]
*
avctx
->
height
);
frame
->
key_frame
=
1
;
...
...
@@ -279,19 +279,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
case
13
:
frame
->
key_frame
=
0
;
frame
->
pict_type
=
AV_PICTURE_TYPE_P
;
if
(
!
c
->
prev
.
data
[
0
])
{
if
(
!
c
->
prev
->
data
[
0
])
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Missing reference frame
\n
"
);
return
AVERROR_INVALIDDATA
;
}
decode_13
(
avctx
,
c
,
frame
->
data
[
0
],
frame
->
linesize
[
0
],
srcptr
,
c
->
prev
.
data
[
0
]);
decode_13
(
avctx
,
c
,
frame
->
data
[
0
],
frame
->
linesize
[
0
],
srcptr
,
c
->
prev
->
data
[
0
]);
break
;
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unknown/unsupported compression type %d
\n
"
,
compr
);
return
AVERROR_INVALIDDATA
;
}
av_frame_unref
(
&
c
->
prev
);
if
((
ret
=
av_frame_ref
(
&
c
->
prev
,
frame
))
<
0
)
av_frame_unref
(
c
->
prev
);
if
((
ret
=
av_frame_ref
(
c
->
prev
,
frame
))
<
0
)
return
ret
;
*
got_frame
=
1
;
...
...
@@ -306,11 +306,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
avcodec_get_frame_defaults
(
&
c
->
prev
);
c
->
prev
=
av_frame_alloc
();
if
(
!
c
->
prev
)
return
AVERROR
(
ENOMEM
);
c
->
dsize
=
avctx
->
width
*
avctx
->
height
*
2
;
c
->
decomp_buf
=
av_malloc
(
c
->
dsize
);
if
(
!
c
->
decomp_buf
)
{
av_frame_free
(
&
c
->
prev
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Can't allocate decompression buffer.
\n
"
);
return
AVERROR
(
ENOMEM
);
}
...
...
@@ -323,7 +326,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
DxaDecContext
*
const
c
=
avctx
->
priv_data
;
av_freep
(
&
c
->
decomp_buf
);
av_frame_
un
re
f
(
&
c
->
prev
);
av_frame_
f
re
e
(
&
c
->
prev
);
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment