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
3ee2c60c
Commit
3ee2c60c
authored
Oct 14, 2015
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: Use data buffers directly instead of an AVPicture
Signed-off-by:
Vittorio Giovara
<
vittorio.giovara@gmail.com
>
parent
ff7956fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
utils.c
libavcodec/utils.c
+10
-9
No files found.
libavcodec/utils.c
View file @
3ee2c60c
...
@@ -337,7 +337,8 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
...
@@ -337,7 +337,8 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
switch
(
avctx
->
codec_type
)
{
switch
(
avctx
->
codec_type
)
{
case
AVMEDIA_TYPE_VIDEO
:
{
case
AVMEDIA_TYPE_VIDEO
:
{
AVPicture
picture
;
uint8_t
*
data
[
4
];
int
linesize
[
4
];
int
size
[
4
]
=
{
0
};
int
size
[
4
]
=
{
0
};
int
w
=
frame
->
width
;
int
w
=
frame
->
width
;
int
h
=
frame
->
height
;
int
h
=
frame
->
height
;
...
@@ -352,27 +353,27 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
...
@@ -352,27 +353,27 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
do
{
do
{
// NOTE: do not align linesizes individually, this breaks e.g. assumptions
// NOTE: do not align linesizes individually, this breaks e.g. assumptions
// that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
// that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
av_image_fill_linesizes
(
picture
.
linesize
,
avctx
->
pix_fmt
,
w
);
av_image_fill_linesizes
(
linesize
,
avctx
->
pix_fmt
,
w
);
// increase alignment of w for next try (rhs gives the lowest bit set in w)
// increase alignment of w for next try (rhs gives the lowest bit set in w)
w
+=
w
&
~
(
w
-
1
);
w
+=
w
&
~
(
w
-
1
);
unaligned
=
0
;
unaligned
=
0
;
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
unaligned
|=
picture
.
linesize
[
i
]
%
pool
->
stride_align
[
i
];
unaligned
|=
linesize
[
i
]
%
pool
->
stride_align
[
i
];
}
while
(
unaligned
);
}
while
(
unaligned
);
tmpsize
=
av_image_fill_pointers
(
picture
.
data
,
avctx
->
pix_fmt
,
h
,
tmpsize
=
av_image_fill_pointers
(
data
,
avctx
->
pix_fmt
,
h
,
NULL
,
picture
.
linesize
);
NULL
,
linesize
);
if
(
tmpsize
<
0
)
if
(
tmpsize
<
0
)
return
-
1
;
return
-
1
;
for
(
i
=
0
;
i
<
3
&&
picture
.
data
[
i
+
1
];
i
++
)
for
(
i
=
0
;
i
<
3
&&
data
[
i
+
1
];
i
++
)
size
[
i
]
=
picture
.
data
[
i
+
1
]
-
picture
.
data
[
i
];
size
[
i
]
=
data
[
i
+
1
]
-
data
[
i
];
size
[
i
]
=
tmpsize
-
(
picture
.
data
[
i
]
-
picture
.
data
[
0
]);
size
[
i
]
=
tmpsize
-
(
data
[
i
]
-
data
[
0
]);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
av_buffer_pool_uninit
(
&
pool
->
pools
[
i
]);
av_buffer_pool_uninit
(
&
pool
->
pools
[
i
]);
pool
->
linesize
[
i
]
=
picture
.
linesize
[
i
];
pool
->
linesize
[
i
]
=
linesize
[
i
];
if
(
size
[
i
])
{
if
(
size
[
i
])
{
pool
->
pools
[
i
]
=
av_buffer_pool_init
(
size
[
i
]
+
16
,
NULL
);
pool
->
pools
[
i
]
=
av_buffer_pool_init
(
size
[
i
]
+
16
,
NULL
);
if
(
!
pool
->
pools
[
i
])
{
if
(
!
pool
->
pools
[
i
])
{
...
...
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