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
6845801f
Commit
6845801f
authored
Jan 17, 2007
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetics
Originally committed as revision 7564 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
75a9fbb9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
imgconvert.c
libavcodec/imgconvert.c
+17
-10
No files found.
libavcodec/imgconvert.c
View file @
6845801f
...
...
@@ -2252,8 +2252,9 @@ int img_crop(AVPicture *dst, const AVPicture *src,
/**
* Pad image
*/
int
img_pad
(
AVPicture
*
dst
,
const
AVPicture
*
src
,
int
height
,
int
width
,
int
pix_fmt
,
int
padtop
,
int
padbottom
,
int
padleft
,
int
padright
,
int
*
color
)
int
img_pad
(
AVPicture
*
dst
,
const
AVPicture
*
src
,
int
height
,
int
width
,
int
pix_fmt
,
int
padtop
,
int
padbottom
,
int
padleft
,
int
padright
,
int
*
color
)
{
uint8_t
*
optr
,
*
iptr
;
int
y_shift
;
...
...
@@ -2261,30 +2262,34 @@ int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix
int
yheight
;
int
i
,
y
;
if
(
pix_fmt
<
0
||
pix_fmt
>=
PIX_FMT_NB
||
!
is_yuv_planar
(
&
pix_fmt_info
[
pix_fmt
]))
return
-
1
;
if
(
pix_fmt
<
0
||
pix_fmt
>=
PIX_FMT_NB
||
!
is_yuv_planar
(
&
pix_fmt_info
[
pix_fmt
]))
return
-
1
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
x_shift
=
i
?
pix_fmt_info
[
pix_fmt
].
x_chroma_shift
:
0
;
y_shift
=
i
?
pix_fmt_info
[
pix_fmt
].
y_chroma_shift
:
0
;
if
(
padtop
||
padleft
)
{
memset
(
dst
->
data
[
i
],
color
[
i
],
dst
->
linesize
[
i
]
*
(
padtop
>>
y_shift
)
+
(
padleft
>>
x_shift
));
memset
(
dst
->
data
[
i
],
color
[
i
],
dst
->
linesize
[
i
]
*
(
padtop
>>
y_shift
)
+
(
padleft
>>
x_shift
));
}
if
(
padleft
||
padright
||
src
)
{
if
(
src
)
{
/* first line */
iptr
=
src
->
data
[
i
];
optr
=
dst
->
data
[
i
]
+
dst
->
linesize
[
i
]
*
(
padtop
>>
y_shift
)
+
(
padleft
>>
x_shift
);
optr
=
dst
->
data
[
i
]
+
dst
->
linesize
[
i
]
*
(
padtop
>>
y_shift
)
+
(
padleft
>>
x_shift
);
memcpy
(
optr
,
iptr
,
src
->
linesize
[
i
]);
iptr
+=
src
->
linesize
[
i
];
}
optr
=
dst
->
data
[
i
]
+
dst
->
linesize
[
i
]
*
(
padtop
>>
y_shift
)
+
(
dst
->
linesize
[
i
]
-
(
padright
>>
x_shift
));
optr
=
dst
->
data
[
i
]
+
dst
->
linesize
[
i
]
*
(
padtop
>>
y_shift
)
+
(
dst
->
linesize
[
i
]
-
(
padright
>>
x_shift
));
yheight
=
(
height
-
1
-
(
padtop
+
padbottom
))
>>
y_shift
;
for
(
y
=
0
;
y
<
yheight
;
y
++
)
{
memset
(
optr
,
color
[
i
],
(
padleft
+
padright
)
>>
x_shift
);
if
(
src
)
{
memcpy
(
optr
+
((
padleft
+
padright
)
>>
x_shift
),
iptr
,
src
->
linesize
[
i
]);
memcpy
(
optr
+
((
padleft
+
padright
)
>>
x_shift
),
iptr
,
src
->
linesize
[
i
]);
iptr
+=
src
->
linesize
[
i
];
}
optr
+=
dst
->
linesize
[
i
];
...
...
@@ -2292,8 +2297,10 @@ int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix
}
if
(
padbottom
||
padright
)
{
optr
=
dst
->
data
[
i
]
+
dst
->
linesize
[
i
]
*
((
height
-
padbottom
)
>>
y_shift
)
-
(
padright
>>
x_shift
);
memset
(
optr
,
color
[
i
],
dst
->
linesize
[
i
]
*
(
padbottom
>>
y_shift
)
+
(
padright
>>
x_shift
));
optr
=
dst
->
data
[
i
]
+
dst
->
linesize
[
i
]
*
((
height
-
padbottom
)
>>
y_shift
)
-
(
padright
>>
x_shift
);
memset
(
optr
,
color
[
i
],
dst
->
linesize
[
i
]
*
(
padbottom
>>
y_shift
)
+
(
padright
>>
x_shift
));
}
}
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