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
1d69dcb8
Commit
1d69dcb8
authored
Jun 06, 2012
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale: unscaled rgb48 <-> bgr48
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
e400b95b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
rgb2rgb.c
libswscale/rgb2rgb.c
+19
-0
rgb2rgb.h
libswscale/rgb2rgb.h
+2
-0
swscale_unscaled.c
libswscale/swscale_unscaled.c
+16
-0
No files found.
libswscale/rgb2rgb.c
View file @
1d69dcb8
...
...
@@ -26,6 +26,7 @@
#include <inttypes.h>
#include "libavutil/bswap.h"
#include "libavutil/intreadwrite.h"
#include "config.h"
#include "rgb2rgb.h"
#include "swscale.h"
...
...
@@ -333,3 +334,21 @@ DEFINE_SHUFFLE_BYTES(0, 3, 2, 1)
DEFINE_SHUFFLE_BYTES
(
1
,
2
,
3
,
0
)
DEFINE_SHUFFLE_BYTES
(
3
,
0
,
1
,
2
)
DEFINE_SHUFFLE_BYTES
(
3
,
2
,
1
,
0
)
#define DEFINE_RGB48TOBGR48(ie, oe) \
void rgb48tobgr48_ ## ie ## oe(const uint8_t *src, \
uint8_t *dst, int src_size) \
{ \
uint16_t *d = (uint16_t *)dst; \
uint16_t *s = (uint16_t *)src; \
int i, num_pixels = src_size >> 1; \
\
for (i = 0; i < num_pixels; i += 3) { \
AV_W ## oe ## 16(&d[i ], AV_R ## ie ## 16(&s[i + 2])); \
AV_W ## oe ## 16(&d[i + 1], AV_R ## ie ## 16(&s[i + 1])); \
AV_W ## oe ## 16(&d[i + 2], AV_R ## ie ## 16(&s[i ])); \
} \
}
DEFINE_RGB48TOBGR48
(
L
,
L
)
DEFINE_RGB48TOBGR48
(
L
,
B
)
libswscale/rgb2rgb.h
View file @
1d69dcb8
...
...
@@ -52,6 +52,8 @@ extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, int src_size);
extern
void
(
*
shuffle_bytes_2103
)(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
);
void
rgb48tobgr48_LL
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
);
void
rgb48tobgr48_LB
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
);
void
rgb24to32
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
);
void
rgb32to24
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
);
void
rgb16tobgr32
(
const
uint8_t
*
src
,
uint8_t
*
dst
,
int
src_size
);
...
...
libswscale/swscale_unscaled.c
View file @
1d69dcb8
...
...
@@ -521,6 +521,13 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
|| (x) == PIX_FMT_ABGR \
)
#define isRGB48(x) ( \
(x) == PIX_FMT_RGB48LE \
|| (x) == PIX_FMT_RGB48BE \
|| (x) == PIX_FMT_BGR48LE \
|| (x) == PIX_FMT_BGR48BE \
)
/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
typedef
void
(
*
rgbConvFn
)
(
const
uint8_t
*
,
uint8_t
*
,
int
);
static
rgbConvFn
findRgbConvFn
(
SwsContext
*
c
)
...
...
@@ -554,6 +561,15 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
||
CONV_IS
(
RGBA
,
BGRA
))
conv
=
shuffle_bytes_2103
;
else
if
(
CONV_IS
(
BGRA
,
ABGR
)
||
CONV_IS
(
RGBA
,
ARGB
))
conv
=
shuffle_bytes_3012
;
}
else
if
(
isRGB48
(
srcFormat
)
&&
isRGB48
(
dstFormat
))
{
if
(
CONV_IS
(
RGB48LE
,
BGR48LE
)
||
CONV_IS
(
BGR48LE
,
RGB48LE
)
||
CONV_IS
(
RGB48BE
,
BGR48BE
)
||
CONV_IS
(
BGR48BE
,
RGB48BE
))
conv
=
rgb48tobgr48_LL
;
else
if
(
CONV_IS
(
RGB48LE
,
BGR48BE
)
||
CONV_IS
(
BGR48LE
,
RGB48BE
)
||
CONV_IS
(
RGB48BE
,
BGR48LE
)
||
CONV_IS
(
BGR48BE
,
RGB48LE
))
conv
=
rgb48tobgr48_LB
;
}
else
/* BGR -> BGR */
if
((
isBGRinInt
(
srcFormat
)
&&
isBGRinInt
(
dstFormat
))
||
...
...
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