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
8dc90371
Commit
8dc90371
authored
Oct 24, 2011
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: add internal function ff_fill_rgba_map()
parent
b76bc010
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
drawutils.c
libavfilter/drawutils.c
+16
-11
drawutils.h
libavfilter/drawutils.h
+2
-0
No files found.
libavfilter/drawutils.c
View file @
8dc90371
...
...
@@ -23,16 +23,8 @@
enum
{
RED
=
0
,
GREEN
,
BLUE
,
ALPHA
};
int
ff_fill_line_with_color
(
uint8_t
*
line
[
4
],
int
pixel_step
[
4
],
int
w
,
uint8_t
dst_color
[
4
],
enum
PixelFormat
pix_fmt
,
uint8_t
rgba_color
[
4
],
int
*
is_packed_rgba
,
uint8_t
rgba_map_ptr
[
4
])
int
ff_fill_rgba_map
(
uint8_t
*
rgba_map
,
enum
PixelFormat
pix_fmt
)
{
uint8_t
rgba_map
[
4
]
=
{
0
};
int
i
;
const
AVPixFmtDescriptor
*
pix_desc
=
&
av_pix_fmt_descriptors
[
pix_fmt
];
int
hsub
=
pix_desc
->
log2_chroma_w
;
*
is_packed_rgba
=
1
;
switch
(
pix_fmt
)
{
case
PIX_FMT_ARGB
:
rgba_map
[
ALPHA
]
=
0
;
rgba_map
[
RED
]
=
1
;
rgba_map
[
GREEN
]
=
2
;
rgba_map
[
BLUE
]
=
3
;
break
;
case
PIX_FMT_ABGR
:
rgba_map
[
ALPHA
]
=
0
;
rgba_map
[
BLUE
]
=
1
;
rgba_map
[
GREEN
]
=
2
;
rgba_map
[
RED
]
=
3
;
break
;
...
...
@@ -40,9 +32,22 @@ int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t
case
PIX_FMT_RGB24
:
rgba_map
[
RED
]
=
0
;
rgba_map
[
GREEN
]
=
1
;
rgba_map
[
BLUE
]
=
2
;
rgba_map
[
ALPHA
]
=
3
;
break
;
case
PIX_FMT_BGRA
:
case
PIX_FMT_BGR24
:
rgba_map
[
BLUE
]
=
0
;
rgba_map
[
GREEN
]
=
1
;
rgba_map
[
RED
]
=
2
;
rgba_map
[
ALPHA
]
=
3
;
break
;
default:
*
is_packed_rgba
=
0
;
default:
/* unsupported */
return
AVERROR
(
EINVAL
)
;
}
return
0
;
}
int
ff_fill_line_with_color
(
uint8_t
*
line
[
4
],
int
pixel_step
[
4
],
int
w
,
uint8_t
dst_color
[
4
],
enum
PixelFormat
pix_fmt
,
uint8_t
rgba_color
[
4
],
int
*
is_packed_rgba
,
uint8_t
rgba_map_ptr
[
4
])
{
uint8_t
rgba_map
[
4
]
=
{
0
};
int
i
;
const
AVPixFmtDescriptor
*
pix_desc
=
&
av_pix_fmt_descriptors
[
pix_fmt
];
int
hsub
=
pix_desc
->
log2_chroma_w
;
*
is_packed_rgba
=
ff_fill_rgba_map
(
rgba_map
,
pix_fmt
)
>=
0
;
if
(
*
is_packed_rgba
)
{
pixel_step
[
0
]
=
(
av_get_bits_per_pixel
(
pix_desc
))
>>
3
;
...
...
libavfilter/drawutils.h
View file @
8dc90371
...
...
@@ -27,6 +27,8 @@
#include <stdint.h>
#include "libavutil/pixfmt.h"
int
ff_fill_rgba_map
(
uint8_t
*
rgba_map
,
enum
PixelFormat
pix_fmt
);
int
ff_fill_line_with_color
(
uint8_t
*
line
[
4
],
int
pixel_step
[
4
],
int
w
,
uint8_t
dst_color
[
4
],
enum
PixelFormat
pix_fmt
,
uint8_t
rgba_color
[
4
],
...
...
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