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
a639ea7f
Commit
a639ea7f
authored
11 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
escape124: use the AVFrame API properly.
parent
224b6edd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/escape124.c
+12
-8
12 additions, 8 deletions
libavcodec/escape124.c
with
12 additions
and
8 deletions
libavcodec/escape124.c
+
12
−
8
View file @
a639ea7f
...
@@ -42,7 +42,7 @@ typedef struct CodeBook {
...
@@ -42,7 +42,7 @@ typedef struct CodeBook {
}
CodeBook
;
}
CodeBook
;
typedef
struct
Escape124Context
{
typedef
struct
Escape124Context
{
AVFrame
frame
;
AVFrame
*
frame
;
unsigned
num_superblocks
;
unsigned
num_superblocks
;
...
@@ -67,6 +67,10 @@ static av_cold int escape124_decode_init(AVCodecContext *avctx)
...
@@ -67,6 +67,10 @@ static av_cold int escape124_decode_init(AVCodecContext *avctx)
s
->
num_superblocks
=
((
unsigned
)
avctx
->
width
/
8
)
*
s
->
num_superblocks
=
((
unsigned
)
avctx
->
width
/
8
)
*
((
unsigned
)
avctx
->
height
/
8
);
((
unsigned
)
avctx
->
height
/
8
);
s
->
frame
=
av_frame_alloc
();
if
(
!
s
->
frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
return
0
;
}
}
...
@@ -78,7 +82,7 @@ static av_cold int escape124_decode_close(AVCodecContext *avctx)
...
@@ -78,7 +82,7 @@ static av_cold int escape124_decode_close(AVCodecContext *avctx)
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
3
;
i
++
)
av_free
(
s
->
codebooks
[
i
].
blocks
);
av_free
(
s
->
codebooks
[
i
].
blocks
);
av_frame_
un
re
f
(
&
s
->
frame
);
av_frame_
f
re
e
(
&
s
->
frame
);
return
0
;
return
0
;
}
}
...
@@ -229,13 +233,13 @@ static int escape124_decode_frame(AVCodecContext *avctx,
...
@@ -229,13 +233,13 @@ static int escape124_decode_frame(AVCodecContext *avctx,
// Leave last frame unchanged
// Leave last frame unchanged
// FIXME: Is this necessary? I haven't seen it in any real samples
// FIXME: Is this necessary? I haven't seen it in any real samples
if
(
!
(
frame_flags
&
0x114
)
||
!
(
frame_flags
&
0x7800000
))
{
if
(
!
(
frame_flags
&
0x114
)
||
!
(
frame_flags
&
0x7800000
))
{
if
(
!
s
->
frame
.
data
[
0
])
if
(
!
s
->
frame
->
data
[
0
])
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
av_log
(
NULL
,
AV_LOG_DEBUG
,
"Skipping frame
\n
"
);
av_log
(
NULL
,
AV_LOG_DEBUG
,
"Skipping frame
\n
"
);
*
got_frame
=
1
;
*
got_frame
=
1
;
if
((
ret
=
av_frame_ref
(
frame
,
&
s
->
frame
))
<
0
)
if
((
ret
=
av_frame_ref
(
frame
,
s
->
frame
))
<
0
)
return
ret
;
return
ret
;
return
frame_size
;
return
frame_size
;
...
@@ -276,8 +280,8 @@ static int escape124_decode_frame(AVCodecContext *avctx,
...
@@ -276,8 +280,8 @@ static int escape124_decode_frame(AVCodecContext *avctx,
new_frame_data
=
(
uint16_t
*
)
frame
->
data
[
0
];
new_frame_data
=
(
uint16_t
*
)
frame
->
data
[
0
];
new_stride
=
frame
->
linesize
[
0
]
/
2
;
new_stride
=
frame
->
linesize
[
0
]
/
2
;
old_frame_data
=
(
uint16_t
*
)
s
->
frame
.
data
[
0
];
old_frame_data
=
(
uint16_t
*
)
s
->
frame
->
data
[
0
];
old_stride
=
s
->
frame
.
linesize
[
0
]
/
2
;
old_stride
=
s
->
frame
->
linesize
[
0
]
/
2
;
for
(
superblock_index
=
0
;
superblock_index
<
s
->
num_superblocks
;
for
(
superblock_index
=
0
;
superblock_index
<
s
->
num_superblocks
;
superblock_index
++
)
{
superblock_index
++
)
{
...
@@ -356,8 +360,8 @@ static int escape124_decode_frame(AVCodecContext *avctx,
...
@@ -356,8 +360,8 @@ static int escape124_decode_frame(AVCodecContext *avctx,
"Escape sizes: %i, %i, %i
\n
"
,
"Escape sizes: %i, %i, %i
\n
"
,
frame_size
,
buf_size
,
get_bits_count
(
&
gb
)
/
8
);
frame_size
,
buf_size
,
get_bits_count
(
&
gb
)
/
8
);
av_frame_unref
(
&
s
->
frame
);
av_frame_unref
(
s
->
frame
);
if
((
ret
=
av_frame_ref
(
&
s
->
frame
,
frame
))
<
0
)
if
((
ret
=
av_frame_ref
(
s
->
frame
,
frame
))
<
0
)
return
ret
;
return
ret
;
*
got_frame
=
1
;
*
got_frame
=
1
;
...
...
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