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
21d82554
Commit
21d82554
authored
Jul 17, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sws: handle non native rgb<->rgb convertions
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
22a27953
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
swscale_unscaled.c
libswscale/swscale_unscaled.c
+14
-7
utils.c
libswscale/utils.c
+2
-1
No files found.
libswscale/swscale_unscaled.c
View file @
21d82554
...
@@ -542,10 +542,6 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
...
@@ -542,10 +542,6 @@ static rgbConvFn findRgbConvFn(SwsContext *c)
(((bpp + 7) >> 3) == 2 && \
(((bpp + 7) >> 3) == 2 && \
(!(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_BE) != !HAVE_BIGENDIAN))
(!(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_BE) != !HAVE_BIGENDIAN))
/* if this is non-native rgb444/555/565, don't handle it here. */
if
(
IS_NOT_NE
(
srcId
,
srcFormat
)
||
IS_NOT_NE
(
dstId
,
dstFormat
))
return
NULL
;
#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)
#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)
if
(
isRGBA32
(
srcFormat
)
&&
isRGBA32
(
dstFormat
))
{
if
(
isRGBA32
(
srcFormat
)
&&
isRGBA32
(
dstFormat
))
{
...
@@ -632,6 +628,9 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
...
@@ -632,6 +628,9 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
}
else
{
}
else
{
const
uint8_t
*
srcPtr
=
src
[
0
];
const
uint8_t
*
srcPtr
=
src
[
0
];
uint8_t
*
dstPtr
=
dst
[
0
];
uint8_t
*
dstPtr
=
dst
[
0
];
int
src_bswap
=
IS_NOT_NE
(
c
->
srcFormatBpp
,
srcFormat
);
int
dst_bswap
=
IS_NOT_NE
(
c
->
dstFormatBpp
,
dstFormat
);
if
((
srcFormat
==
PIX_FMT_RGB32_1
||
srcFormat
==
PIX_FMT_BGR32_1
)
&&
if
((
srcFormat
==
PIX_FMT_RGB32_1
||
srcFormat
==
PIX_FMT_BGR32_1
)
&&
!
isRGBA32
(
dstFormat
))
!
isRGBA32
(
dstFormat
))
srcPtr
+=
ALT32_CORR
;
srcPtr
+=
ALT32_CORR
;
...
@@ -641,15 +640,23 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
...
@@ -641,15 +640,23 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
dstPtr
+=
ALT32_CORR
;
dstPtr
+=
ALT32_CORR
;
if
(
dstStride
[
0
]
*
srcBpp
==
srcStride
[
0
]
*
dstBpp
&&
srcStride
[
0
]
>
0
&&
if
(
dstStride
[
0
]
*
srcBpp
==
srcStride
[
0
]
*
dstBpp
&&
srcStride
[
0
]
>
0
&&
!
(
srcStride
[
0
]
%
srcBpp
))
!
(
srcStride
[
0
]
%
srcBpp
)
&&
!
dst_bswap
&&
!
src_bswap
)
conv
(
srcPtr
,
dstPtr
+
dstStride
[
0
]
*
srcSliceY
,
conv
(
srcPtr
,
dstPtr
+
dstStride
[
0
]
*
srcSliceY
,
srcSliceH
*
srcStride
[
0
]);
srcSliceH
*
srcStride
[
0
]);
else
{
else
{
int
i
;
int
i
,
j
;
dstPtr
+=
dstStride
[
0
]
*
srcSliceY
;
dstPtr
+=
dstStride
[
0
]
*
srcSliceY
;
for
(
i
=
0
;
i
<
srcSliceH
;
i
++
)
{
for
(
i
=
0
;
i
<
srcSliceH
;
i
++
)
{
conv
(
srcPtr
,
dstPtr
,
c
->
srcW
*
srcBpp
);
if
(
src_bswap
)
{
for
(
j
=
0
;
j
<
c
->
srcW
;
j
++
)
((
uint16_t
*
)
c
->
formatConvBuffer
)[
j
]
=
av_bswap16
(((
uint16_t
*
)
srcPtr
)[
j
]);
conv
(
c
->
formatConvBuffer
,
dstPtr
,
c
->
srcW
*
srcBpp
);
}
else
conv
(
srcPtr
,
dstPtr
,
c
->
srcW
*
srcBpp
);
if
(
dst_bswap
)
for
(
j
=
0
;
j
<
c
->
srcW
;
j
++
)
((
uint16_t
*
)
dstPtr
)[
j
]
=
av_bswap16
(((
uint16_t
*
)
dstPtr
)[
j
]);
srcPtr
+=
srcStride
[
0
];
srcPtr
+=
srcStride
[
0
];
dstPtr
+=
dstStride
[
0
];
dstPtr
+=
dstStride
[
0
];
}
}
...
...
libswscale/utils.c
View file @
21d82554
...
@@ -996,6 +996,8 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
...
@@ -996,6 +996,8 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
c
->
chrDstW
=
-
((
-
dstW
)
>>
c
->
chrDstHSubSample
);
c
->
chrDstW
=
-
((
-
dstW
)
>>
c
->
chrDstHSubSample
);
c
->
chrDstH
=
-
((
-
dstH
)
>>
c
->
chrDstVSubSample
);
c
->
chrDstH
=
-
((
-
dstH
)
>>
c
->
chrDstVSubSample
);
FF_ALLOC_OR_GOTO
(
c
,
c
->
formatConvBuffer
,
FFALIGN
(
srcW
*
2
+
78
,
16
)
*
2
,
fail
);
/* unscaled special cases */
/* unscaled special cases */
if
(
unscaled
&&
!
usesHFilter
&&
!
usesVFilter
&&
if
(
unscaled
&&
!
usesHFilter
&&
!
usesVFilter
&&
(
c
->
srcRange
==
c
->
dstRange
||
isAnyRGB
(
dstFormat
)))
{
(
c
->
srcRange
==
c
->
dstRange
||
isAnyRGB
(
dstFormat
)))
{
...
@@ -1020,7 +1022,6 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
...
@@ -1020,7 +1022,6 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
c
->
srcBpc
=
16
;
c
->
srcBpc
=
16
;
if
(
c
->
dstBpc
==
16
)
if
(
c
->
dstBpc
==
16
)
dst_stride
<<=
1
;
dst_stride
<<=
1
;
FF_ALLOC_OR_GOTO
(
c
,
c
->
formatConvBuffer
,
FFALIGN
(
srcW
*
2
+
78
,
16
)
*
2
,
fail
);
if
(
HAVE_MMX2
&&
cpu_flags
&
AV_CPU_FLAG_MMX2
&&
if
(
HAVE_MMX2
&&
cpu_flags
&
AV_CPU_FLAG_MMX2
&&
c
->
srcBpc
==
8
&&
c
->
dstBpc
<=
14
)
{
c
->
srcBpc
==
8
&&
c
->
dstBpc
<=
14
)
{
c
->
canMMX2BeUsed
=
(
dstW
>=
srcW
&&
(
dstW
&
31
)
==
0
&&
c
->
canMMX2BeUsed
=
(
dstW
>=
srcW
&&
(
dstW
&
31
)
==
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