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
f89ec87a
Commit
f89ec87a
authored
Jul 27, 2018
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
frame: Simplify the video allocation
parent
e1e3a122
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
20 deletions
+9
-20
frame.c
libavutil/frame.c
+9
-20
No files found.
libavutil/frame.c
View file @
f89ec87a
...
...
@@ -89,12 +89,8 @@ void av_frame_free(AVFrame **frame)
static
int
get_video_buffer
(
AVFrame
*
frame
,
int
align
)
{
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
frame
->
format
);
int
ret
,
i
;
if
(
!
desc
)
return
AVERROR
(
EINVAL
);
if
((
ret
=
av_image_check_size
(
frame
->
width
,
frame
->
height
,
0
,
NULL
))
<
0
)
return
ret
;
...
...
@@ -111,24 +107,17 @@ static int get_video_buffer(AVFrame *frame, int align)
frame
->
linesize
[
i
]
=
FFALIGN
(
frame
->
linesize
[
i
],
align
);
}
for
(
i
=
0
;
i
<
4
&&
frame
->
linesize
[
i
];
i
++
)
{
int
h
=
frame
->
height
;
if
(
i
==
1
||
i
==
2
)
h
=
AV_CEIL_RSHIFT
(
h
,
desc
->
log2_chroma_h
);
if
((
ret
=
av_image_fill_pointers
(
frame
->
data
,
frame
->
format
,
frame
->
height
,
NULL
,
frame
->
linesize
))
<
0
)
return
ret
;
frame
->
buf
[
i
]
=
av_buffer_alloc
(
frame
->
linesize
[
i
]
*
h
);
if
(
!
frame
->
buf
[
i
])
goto
fail
;
frame
->
buf
[
0
]
=
av_buffer_alloc
(
ret
);
if
(
!
frame
->
buf
[
0
])
goto
fail
;
frame
->
data
[
i
]
=
frame
->
buf
[
i
]
->
data
;
}
if
(
desc
->
flags
&
AV_PIX_FMT_FLAG_PAL
||
desc
->
flags
&
AV_PIX_FMT_FLAG_PSEUDOPAL
)
{
av_buffer_unref
(
&
frame
->
buf
[
1
]);
frame
->
buf
[
1
]
=
av_buffer_alloc
(
1024
);
if
(
!
frame
->
buf
[
1
])
goto
fail
;
frame
->
data
[
1
]
=
frame
->
buf
[
1
]
->
data
;
}
if
(
av_image_fill_pointers
(
frame
->
data
,
frame
->
format
,
frame
->
height
,
frame
->
buf
[
0
]
->
data
,
frame
->
linesize
)
<
0
)
goto
fail
;
frame
->
extended_data
=
frame
->
data
;
...
...
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