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
1afbae10
Commit
1afbae10
authored
Mar 17, 2011
by
Peter Ross
Committed by
Anton Khirnov
Apr 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libswcale: PIX_FMT_BGR48LE and PIX_FMT_BGR48BE scaler implementation
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
b2395268
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
125 additions
and
3 deletions
+125
-3
swscale.c
libswscale/swscale.c
+57
-0
swscale.h
libswscale/swscale.h
+1
-1
swscale_internal.h
libswscale/swscale_internal.h
+8
-2
swscale_template.c
libswscale/swscale_template.c
+7
-0
utils.c
libswscale/utils.c
+2
-0
yuv2rgb.c
libswscale/yuv2rgb.c
+38
-0
pixdesc_be
tests/ref/lavfi/pixdesc_be
+2
-0
pixdesc_le
tests/ref/lavfi/pixdesc_le
+2
-0
pixfmts_copy_le
tests/ref/lavfi/pixfmts_copy_le
+2
-0
pixfmts_null_le
tests/ref/lavfi/pixfmts_null_le
+2
-0
pixfmts_scale_le
tests/ref/lavfi/pixfmts_scale_le
+2
-0
pixfmts_vflip_le
tests/ref/lavfi/pixfmts_vflip_le
+2
-0
No files found.
libswscale/swscale.c
View file @
1afbae10
...
...
@@ -639,6 +639,18 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc
dest+=12;\
}\
break;\
case PIX_FMT_BGR48BE:\
case PIX_FMT_BGR48LE:\
func(uint8_t,0)\
((uint8_t*)dest)[ 0] = ((uint8_t*)dest)[ 1] = b[Y1];\
((uint8_t*)dest)[ 2] = ((uint8_t*)dest)[ 3] = g[Y1];\
((uint8_t*)dest)[ 4] = ((uint8_t*)dest)[ 5] = r[Y1];\
((uint8_t*)dest)[ 6] = ((uint8_t*)dest)[ 7] = b[Y2];\
((uint8_t*)dest)[ 8] = ((uint8_t*)dest)[ 9] = g[Y2];\
((uint8_t*)dest)[10] = ((uint8_t*)dest)[11] = r[Y2];\
dest+=12;\
}\
break;\
case PIX_FMT_RGBA:\
case PIX_FMT_BGRA:\
if (CONFIG_SMALL) {\
...
...
@@ -976,6 +988,49 @@ static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV,
}
}
static
inline
void
bgr48ToY
(
uint8_t
*
dst
,
const
uint8_t
*
src
,
long
width
,
uint32_t
*
unused
)
{
int
i
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
b
=
src
[
i
*
6
+
0
];
int
g
=
src
[
i
*
6
+
2
];
int
r
=
src
[
i
*
6
+
4
];
dst
[
i
]
=
(
RY
*
r
+
GY
*
g
+
BY
*
b
+
(
33
<<
(
RGB2YUV_SHIFT
-
1
)))
>>
RGB2YUV_SHIFT
;
}
}
static
inline
void
bgr48ToUV
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
long
width
,
uint32_t
*
unused
)
{
int
i
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
b
=
src1
[
6
*
i
+
0
];
int
g
=
src1
[
6
*
i
+
2
];
int
r
=
src1
[
6
*
i
+
4
];
dstU
[
i
]
=
(
RU
*
r
+
GU
*
g
+
BU
*
b
+
(
257
<<
(
RGB2YUV_SHIFT
-
1
)))
>>
RGB2YUV_SHIFT
;
dstV
[
i
]
=
(
RV
*
r
+
GV
*
g
+
BV
*
b
+
(
257
<<
(
RGB2YUV_SHIFT
-
1
)))
>>
RGB2YUV_SHIFT
;
}
}
static
inline
void
bgr48ToUV_half
(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
long
width
,
uint32_t
*
unused
)
{
int
i
;
for
(
i
=
0
;
i
<
width
;
i
++
)
{
int
b
=
src1
[
12
*
i
+
0
]
+
src1
[
12
*
i
+
6
];
int
g
=
src1
[
12
*
i
+
2
]
+
src1
[
12
*
i
+
8
];
int
r
=
src1
[
12
*
i
+
4
]
+
src1
[
12
*
i
+
10
];
dstU
[
i
]
=
(
RU
*
r
+
GU
*
g
+
BU
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
);
dstV
[
i
]
=
(
RV
*
r
+
GV
*
g
+
BV
*
b
+
(
257
<<
RGB2YUV_SHIFT
))
>>
(
RGB2YUV_SHIFT
+
1
);
}
}
#define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)\
static inline void name(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)\
{\
...
...
@@ -1717,6 +1772,8 @@ void ff_get_unscaled_swscale(SwsContext *c)
&&
srcFormat
!=
PIX_FMT_MONOWHITE
&&
dstFormat
!=
PIX_FMT_MONOWHITE
&&
srcFormat
!=
PIX_FMT_RGB48LE
&&
dstFormat
!=
PIX_FMT_RGB48LE
&&
srcFormat
!=
PIX_FMT_RGB48BE
&&
dstFormat
!=
PIX_FMT_RGB48BE
&&
srcFormat
!=
PIX_FMT_BGR48LE
&&
dstFormat
!=
PIX_FMT_BGR48LE
&&
srcFormat
!=
PIX_FMT_BGR48BE
&&
dstFormat
!=
PIX_FMT_BGR48BE
&&
(
!
needsDither
||
(
c
->
flags
&
(
SWS_FAST_BILINEAR
|
SWS_POINT
))))
c
->
swScale
=
rgbToRgbWrapper
;
...
...
libswscale/swscale.h
View file @
1afbae10
...
...
@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBSWSCALE_VERSION_MAJOR 1
#define LIBSWSCALE_VERSION_MINOR
0
#define LIBSWSCALE_VERSION_MINOR
1
#define LIBSWSCALE_VERSION_MICRO 0
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
...
...
libswscale/swscale_internal.h
View file @
1afbae10
...
...
@@ -343,6 +343,8 @@ const char *sws_format_name(enum PixelFormat format);
#define is16BPS(x) ( \
(x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \
|| (x)==PIX_FMT_BGR48BE \
|| (x)==PIX_FMT_BGR48LE \
|| (x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \
|| (x)==PIX_FMT_YUV420P16LE \
...
...
@@ -407,7 +409,9 @@ const char *sws_format_name(enum PixelFormat format);
|| (x)==PIX_FMT_MONOWHITE \
)
#define isBGRinInt(x) ( \
(x)==PIX_FMT_BGR32 \
(x)==PIX_FMT_BGR48BE \
|| (x)==PIX_FMT_BGR48LE \
|| (x)==PIX_FMT_BGR32 \
|| (x)==PIX_FMT_BGR32_1 \
|| (x)==PIX_FMT_BGR24 \
|| (x)==PIX_FMT_BGR565BE \
...
...
@@ -430,7 +434,9 @@ const char *sws_format_name(enum PixelFormat format);
|| (x)==PIX_FMT_RGB24 \
)
#define isBGRinBytes(x) ( \
(x)==PIX_FMT_BGRA \
(x)==PIX_FMT_BGR48BE \
|| (x)==PIX_FMT_BGR48LE \
|| (x)==PIX_FMT_BGRA \
|| (x)==PIX_FMT_ABGR \
|| (x)==PIX_FMT_BGR24 \
)
...
...
libswscale/swscale_template.c
View file @
1afbae10
...
...
@@ -801,6 +801,8 @@ static void sws_init_swScale_c(SwsContext *c)
switch
(
srcFormat
)
{
case
PIX_FMT_RGB48BE
:
case
PIX_FMT_RGB48LE
:
c
->
chrToYV12
=
rgb48ToUV_half
;
break
;
case
PIX_FMT_BGR48BE
:
case
PIX_FMT_BGR48LE
:
c
->
chrToYV12
=
bgr48ToUV_half
;
break
;
case
PIX_FMT_RGB32
:
c
->
chrToYV12
=
bgr32ToUV_half
;
break
;
case
PIX_FMT_RGB32_1
:
c
->
chrToYV12
=
bgr321ToUV_half
;
break
;
case
PIX_FMT_BGR24
:
c
->
chrToYV12
=
bgr24ToUV_half_c
;
break
;
...
...
@@ -816,6 +818,8 @@ static void sws_init_swScale_c(SwsContext *c)
switch
(
srcFormat
)
{
case
PIX_FMT_RGB48BE
:
case
PIX_FMT_RGB48LE
:
c
->
chrToYV12
=
rgb48ToUV
;
break
;
case
PIX_FMT_BGR48BE
:
case
PIX_FMT_BGR48LE
:
c
->
chrToYV12
=
bgr48ToUV
;
break
;
case
PIX_FMT_RGB32
:
c
->
chrToYV12
=
bgr32ToUV
;
break
;
case
PIX_FMT_RGB32_1
:
c
->
chrToYV12
=
bgr321ToUV
;
break
;
case
PIX_FMT_BGR24
:
c
->
chrToYV12
=
bgr24ToUV_c
;
break
;
...
...
@@ -862,6 +866,8 @@ static void sws_init_swScale_c(SwsContext *c)
case
PIX_FMT_BGR32_1
:
c
->
lumToYV12
=
rgb321ToY
;
break
;
case
PIX_FMT_RGB48BE
:
case
PIX_FMT_RGB48LE
:
c
->
lumToYV12
=
rgb48ToY
;
break
;
case
PIX_FMT_BGR48BE
:
case
PIX_FMT_BGR48LE
:
c
->
lumToYV12
=
bgr48ToY
;
break
;
}
if
(
c
->
alpPixBuf
)
{
switch
(
srcFormat
)
{
...
...
@@ -882,6 +888,7 @@ static void sws_init_swScale_c(SwsContext *c)
c
->
alpSrcOffset
=
3
;
break
;
case
PIX_FMT_RGB48LE
:
case
PIX_FMT_BGR48LE
:
c
->
lumSrcOffset
=
1
;
c
->
chrSrcOffset
=
1
;
c
->
alpSrcOffset
=
1
;
...
...
libswscale/utils.c
View file @
1afbae10
...
...
@@ -73,6 +73,8 @@ const char *swscale_license(void)
|| (x)==PIX_FMT_RGB48LE \
|| (x)==PIX_FMT_RGB32 \
|| (x)==PIX_FMT_RGB32_1 \
|| (x)==PIX_FMT_BGR48BE \
|| (x)==PIX_FMT_BGR48LE \
|| (x)==PIX_FMT_BGR24 \
|| (x)==PIX_FMT_BGR565 \
|| (x)==PIX_FMT_BGR555 \
...
...
libswscale/yuv2rgb.c
View file @
1afbae10
...
...
@@ -99,6 +99,16 @@ const int *sws_getCoefficients(int colorspace)
dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
dst[12*i+10] = dst[12*i+11] = b[Y];
#define PUTBGR48(dst,src,i) \
Y = src[2*i]; \
dst[12*i+ 0] = dst[12*i+ 1] = b[Y]; \
dst[12*i+ 2] = dst[12*i+ 3] = g[Y]; \
dst[12*i+ 4] = dst[12*i+ 5] = r[Y]; \
Y = src[2*i+1]; \
dst[12*i+ 6] = dst[12*i+ 7] = b[Y]; \
dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
dst[12*i+10] = dst[12*i+11] = r[Y];
#define YUV2RGBFUNC(func_name, dst_type, alpha) \
static int func_name(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, \
int srcSliceH, uint8_t* dst[], int dstStride[]) \
...
...
@@ -175,6 +185,32 @@ ENDYUV2RGBLINE(48)
PUTRGB48
(
dst_1
,
py_1
,
1
);
ENDYUV2RGBFUNC
()
YUV2RGBFUNC
(
yuv2rgb_c_bgr48
,
uint8_t
,
0
)
LOADCHROMA
(
0
);
PUTBGR48
(
dst_1
,
py_1
,
0
);
PUTBGR48
(
dst_2
,
py_2
,
0
);
LOADCHROMA
(
1
);
PUTBGR48
(
dst_2
,
py_2
,
1
);
PUTBGR48
(
dst_1
,
py_1
,
1
);
LOADCHROMA
(
2
);
PUTBGR48
(
dst_1
,
py_1
,
2
);
PUTBGR48
(
dst_2
,
py_2
,
2
);
LOADCHROMA
(
3
);
PUTBGR48
(
dst_2
,
py_2
,
3
);
PUTBGR48
(
dst_1
,
py_1
,
3
);
ENDYUV2RGBLINE
(
48
)
LOADCHROMA
(
0
);
PUTBGR48
(
dst_1
,
py_1
,
0
);
PUTBGR48
(
dst_2
,
py_2
,
0
);
LOADCHROMA
(
1
);
PUTBGR48
(
dst_2
,
py_2
,
1
);
PUTBGR48
(
dst_1
,
py_1
,
1
);
ENDYUV2RGBFUNC
()
YUV2RGBFUNC
(
yuv2rgb_c_32
,
uint32_t
,
0
)
LOADCHROMA
(
0
);
PUTRGB
(
dst_1
,
py_1
,
0
);
...
...
@@ -568,6 +604,8 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
av_log
(
c
,
AV_LOG_WARNING
,
"No accelerated colorspace conversion found from %s to %s.
\n
"
,
sws_format_name
(
c
->
srcFormat
),
sws_format_name
(
c
->
dstFormat
));
switch
(
c
->
dstFormat
)
{
case
PIX_FMT_BGR48BE
:
case
PIX_FMT_BGR48LE
:
return
yuv2rgb_c_bgr48
;
case
PIX_FMT_RGB48BE
:
case
PIX_FMT_RGB48LE
:
return
yuv2rgb_c_48
;
case
PIX_FMT_ARGB
:
...
...
tests/ref/lavfi/pixdesc_be
View file @
1afbae10
abgr 037bf9df6a765520ad6d490066bf4b89
argb c442a8261c2265a07212ef0f72e35f5a
bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b
bgr48be 4ba0ff7fc9e011ea264610ad1585bb1f
bgr48le d022bfdd6a07d5dcc693799322a386b4
bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806
bgr555be 49f01b1f1f0c84fd9e776dd34cc3c280
bgr565be 257cf78afa35dc31e9696f139c916715
...
...
tests/ref/lavfi/pixdesc_le
View file @
1afbae10
abgr 037bf9df6a765520ad6d490066bf4b89
argb c442a8261c2265a07212ef0f72e35f5a
bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b
bgr48be 4ba0ff7fc9e011ea264610ad1585bb1f
bgr48le d022bfdd6a07d5dcc693799322a386b4
bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806
bgr555le 378d6ac4223651a1adcbf94a3d0d807b
bgr565le 1dfdd03995c287e3c754b164bf26a355
...
...
tests/ref/lavfi/pixfmts_copy_le
View file @
1afbae10
abgr 037bf9df6a765520ad6d490066bf4b89
argb c442a8261c2265a07212ef0f72e35f5a
bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b
bgr48be 4ba0ff7fc9e011ea264610ad1585bb1f
bgr48le d022bfdd6a07d5dcc693799322a386b4
bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806
bgr555le 378d6ac4223651a1adcbf94a3d0d807b
bgr565le 1dfdd03995c287e3c754b164bf26a355
...
...
tests/ref/lavfi/pixfmts_null_le
View file @
1afbae10
abgr 037bf9df6a765520ad6d490066bf4b89
argb c442a8261c2265a07212ef0f72e35f5a
bgr24 0d0cb38ab3fa0b2ec0865c14f78b217b
bgr48be 4ba0ff7fc9e011ea264610ad1585bb1f
bgr48le d022bfdd6a07d5dcc693799322a386b4
bgr4_byte 50d23cc82d9dcef2fd12adb81fb9b806
bgr555le 378d6ac4223651a1adcbf94a3d0d807b
bgr565le 1dfdd03995c287e3c754b164bf26a355
...
...
tests/ref/lavfi/pixfmts_scale_le
View file @
1afbae10
abgr d894cb97f6c80eb21bdbe8a4eea62d86
argb 54346f2b2eef10919e0f247241df3b24
bgr24 570f8d6b51a838aed022ef67535f6bdc
bgr48be fcc0f2dbf45d325f84f816c74cbeeebe
bgr48le 3f9c2b23eed3b8d196d1c14b38ce50f5
bgr4_byte ee1d35a7baf8e9016891929a2f565c0b
bgr555le 36b745067197f9ca8c1731cac51329c9
bgr565le 3a514a298c6161a071ddf9963c06509d
...
...
tests/ref/lavfi/pixfmts_vflip_le
View file @
1afbae10
abgr 25e72e9dbd01ab00727c976d577f7be5
argb 19869bf1a5ac0b6af4d8bbe2c104533c
bgr24 89108a4ba00201f79b75b9305c42352d
bgr48be ed82382da09b64a8e04728fcf76e6814
bgr48le 0f1f135608c2ff24d26d03e939fc2112
bgr4_byte 407fcf564ed764c38e1d748f700ab921
bgr555le bd7b3ec4d684dfad075d89a606cb8b74
bgr565le fdb617533e1e7ff512ea5b6b6233e738
...
...
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