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
1e79926f
Commit
1e79926f
authored
Nov 06, 2011
by
Themaister
Committed by
Michael Niedermayer
Nov 06, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unscaled Planar RGB -> RGB support in swscale.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
079700f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
swscale_unscaled.c
libswscale/swscale_unscaled.c
+89
-0
No files found.
libswscale/swscale_unscaled.c
View file @
1e79926f
...
...
@@ -255,6 +255,92 @@ static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[],
return
srcSliceH
;
}
static
void
gbr24ptopacked24
(
const
uint8_t
*
src
[],
int
srcStride
[],
uint8_t
*
dst
,
int
dstStride
,
int
srcSliceH
,
int
width
)
{
int
x
,
h
,
i
;
for
(
h
=
0
;
h
<
srcSliceH
;
h
++
)
{
uint8_t
*
dest
=
dst
+
dstStride
*
h
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
*
dest
++
=
src
[
0
][
x
];
*
dest
++
=
src
[
1
][
x
];
*
dest
++
=
src
[
2
][
x
];
}
for
(
i
=
0
;
i
<
3
;
i
++
)
src
[
i
]
+=
srcStride
[
i
];
}
}
static
void
gbr24ptopacked32
(
const
uint8_t
*
src
[],
int
srcStride
[],
uint8_t
*
dst
,
int
dstStride
,
int
srcSliceH
,
int
alpha_first
,
int
width
)
{
int
x
,
h
,
i
;
for
(
h
=
0
;
h
<
srcSliceH
;
h
++
)
{
uint8_t
*
dest
=
dst
+
dstStride
*
h
;
if
(
alpha_first
)
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
*
dest
++
=
0xff
;
*
dest
++
=
src
[
0
][
x
];
*
dest
++
=
src
[
1
][
x
];
*
dest
++
=
src
[
2
][
x
];
}
}
else
{
for
(
x
=
0
;
x
<
width
;
x
++
)
{
*
dest
++
=
src
[
0
][
x
];
*
dest
++
=
src
[
1
][
x
];
*
dest
++
=
src
[
2
][
x
];
*
dest
++
=
0xff
;
}
}
for
(
i
=
0
;
i
<
3
;
i
++
)
src
[
i
]
+=
srcStride
[
i
];
}
}
static
int
planarRgbToRgbWrapper
(
SwsContext
*
c
,
const
uint8_t
*
src
[],
int
srcStride
[],
int
srcSliceY
,
int
srcSliceH
,
uint8_t
*
dst
[],
int
dstStride
[])
{
int
alpha_first
=
0
;
if
(
c
->
srcFormat
!=
PIX_FMT_GBR24P
)
{
av_log
(
c
,
AV_LOG_ERROR
,
"unsupported planar RGB conversion %s -> %s
\n
"
,
av_get_pix_fmt_name
(
c
->
srcFormat
),
av_get_pix_fmt_name
(
c
->
dstFormat
));
return
srcSliceH
;
}
switch
(
c
->
dstFormat
)
{
case
PIX_FMT_BGR24
:
gbr24ptopacked24
((
const
uint8_t
*
[])
{
src
[
1
],
src
[
0
],
src
[
2
]},
(
int
[])
{
srcStride
[
1
],
srcStride
[
0
],
srcStride
[
2
]},
dst
[
0
]
+
srcSliceY
*
dstStride
[
0
],
dstStride
[
0
],
srcSliceH
,
c
->
srcW
);
break
;
case
PIX_FMT_RGB24
:
gbr24ptopacked24
((
const
uint8_t
*
[])
{
src
[
2
],
src
[
0
],
src
[
1
]},
(
int
[])
{
srcStride
[
2
],
srcStride
[
0
],
srcStride
[
1
]},
dst
[
0
]
+
srcSliceY
*
dstStride
[
0
],
dstStride
[
0
],
srcSliceH
,
c
->
srcW
);
break
;
case
PIX_FMT_ARGB
:
alpha_first
=
1
;
case
PIX_FMT_RGBA
:
gbr24ptopacked32
((
const
uint8_t
*
[])
{
src
[
2
],
src
[
0
],
src
[
1
]},
(
int
[])
{
srcStride
[
2
],
srcStride
[
0
],
srcStride
[
1
]},
dst
[
0
]
+
srcSliceY
*
dstStride
[
0
],
dstStride
[
0
],
srcSliceH
,
alpha_first
,
c
->
srcW
);
break
;
case
PIX_FMT_ABGR
:
alpha_first
=
1
;
case
PIX_FMT_BGRA
:
gbr24ptopacked32
((
const
uint8_t
*
[])
{
src
[
1
],
src
[
0
],
src
[
2
]},
(
int
[])
{
srcStride
[
1
],
srcStride
[
0
],
srcStride
[
2
]},
dst
[
0
]
+
srcSliceY
*
dstStride
[
0
],
dstStride
[
0
],
srcSliceH
,
alpha_first
,
c
->
srcW
);
break
;
default:
av_log
(
c
,
AV_LOG_ERROR
,
"unsupported planar RGB conversion %s -> %s
\n
"
,
av_get_pix_fmt_name
(
c
->
srcFormat
),
av_get_pix_fmt_name
(
c
->
dstFormat
));
}
return
srcSliceH
;
}
#define isRGBA32(x) ( \
(x) == PIX_FMT_ARGB \
|| (x) == PIX_FMT_RGBA \
...
...
@@ -608,6 +694,9 @@ void ff_get_unscaled_swscale(SwsContext *c)
&&
(
!
needsDither
||
(
c
->
flags
&
(
SWS_FAST_BILINEAR
|
SWS_POINT
))))
c
->
swScale
=
rgbToRgbWrapper
;
if
(
isAnyRGB
(
srcFormat
)
&&
isPlanar
(
srcFormat
)
&&
isAnyRGB
(
dstFormat
)
&&
!
isPlanar
(
dstFormat
))
c
->
swScale
=
planarRgbToRgbWrapper
;
if
((
usePal
(
srcFormat
)
&&
(
dstFormat
==
PIX_FMT_RGB32
||
dstFormat
==
PIX_FMT_RGB32_1
||
...
...
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