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
ef627bf9
Commit
ef627bf9
authored
Nov 19, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swscale: add nv12/nv21->yuv420 converter
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
722fb81d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
0 deletions
+52
-0
rgb2rgb.c
libswscale/rgb2rgb.c
+3
-0
rgb2rgb.h
libswscale/rgb2rgb.h
+4
-0
rgb2rgb_template.c
libswscale/rgb2rgb_template.c
+19
-0
swscale_unscaled.c
libswscale/swscale_unscaled.c
+26
-0
No files found.
libswscale/rgb2rgb.c
View file @
ef627bf9
...
@@ -83,6 +83,9 @@ void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height,
...
@@ -83,6 +83,9 @@ void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height,
void
(
*
interleaveBytes
)(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
uint8_t
*
dst
,
void
(
*
interleaveBytes
)(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
uint8_t
*
dst
,
int
width
,
int
height
,
int
src1Stride
,
int
width
,
int
height
,
int
src1Stride
,
int
src2Stride
,
int
dstStride
);
int
src2Stride
,
int
dstStride
);
void
(
*
deinterleaveBytes
)(
const
uint8_t
*
src
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
int
width
,
int
height
,
int
srcStride
,
int
dst1Stride
,
int
dst2Stride
);
void
(
*
vu9_to_vu12
)(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
void
(
*
vu9_to_vu12
)(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
int
width
,
int
height
,
int
width
,
int
height
,
...
...
libswscale/rgb2rgb.h
View file @
ef627bf9
...
@@ -135,6 +135,10 @@ extern void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t
...
@@ -135,6 +135,10 @@ extern void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t
int
width
,
int
height
,
int
src1Stride
,
int
width
,
int
height
,
int
src1Stride
,
int
src2Stride
,
int
dstStride
);
int
src2Stride
,
int
dstStride
);
extern
void
(
*
deinterleaveBytes
)(
const
uint8_t
*
src
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
int
width
,
int
height
,
int
srcStride
,
int
dst1Stride
,
int
dst2Stride
);
extern
void
(
*
vu9_to_vu12
)(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
extern
void
(
*
vu9_to_vu12
)(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
int
width
,
int
height
,
int
width
,
int
height
,
...
...
libswscale/rgb2rgb_template.c
View file @
ef627bf9
...
@@ -693,6 +693,24 @@ static void interleaveBytes_c(const uint8_t *src1, const uint8_t *src2,
...
@@ -693,6 +693,24 @@ static void interleaveBytes_c(const uint8_t *src1, const uint8_t *src2,
}
}
}
}
static
void
deinterleaveBytes_c
(
const
uint8_t
*
src
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
int
width
,
int
height
,
int
srcStride
,
int
dst1Stride
,
int
dst2Stride
)
{
int
h
;
for
(
h
=
0
;
h
<
height
;
h
++
)
{
int
w
;
for
(
w
=
0
;
w
<
width
;
w
++
)
{
dst1
[
w
]
=
src
[
2
*
w
+
0
];
dst2
[
w
]
=
src
[
2
*
w
+
1
];
}
src
+=
srcStride
;
dst1
+=
dst1Stride
;
dst2
+=
dst2Stride
;
}
}
static
inline
void
vu9_to_vu12_c
(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
static
inline
void
vu9_to_vu12_c
(
const
uint8_t
*
src1
,
const
uint8_t
*
src2
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
uint8_t
*
dst1
,
uint8_t
*
dst2
,
int
width
,
int
height
,
int
width
,
int
height
,
...
@@ -922,6 +940,7 @@ static av_cold void rgb2rgb_init_c(void)
...
@@ -922,6 +940,7 @@ static av_cold void rgb2rgb_init_c(void)
planar2x
=
planar2x_c
;
planar2x
=
planar2x_c
;
ff_rgb24toyv12
=
ff_rgb24toyv12_c
;
ff_rgb24toyv12
=
ff_rgb24toyv12_c
;
interleaveBytes
=
interleaveBytes_c
;
interleaveBytes
=
interleaveBytes_c
;
deinterleaveBytes
=
deinterleaveBytes_c
;
vu9_to_vu12
=
vu9_to_vu12_c
;
vu9_to_vu12
=
vu9_to_vu12_c
;
yvu9_to_yuy2
=
yvu9_to_yuy2_c
;
yvu9_to_yuy2
=
yvu9_to_yuy2_c
;
...
...
libswscale/swscale_unscaled.c
View file @
ef627bf9
...
@@ -176,6 +176,27 @@ static int planarToNv12Wrapper(SwsContext *c, const uint8_t *src[],
...
@@ -176,6 +176,27 @@ static int planarToNv12Wrapper(SwsContext *c, const uint8_t *src[],
return
srcSliceH
;
return
srcSliceH
;
}
}
static
int
nv12ToPlanarWrapper
(
SwsContext
*
c
,
const
uint8_t
*
src
[],
int
srcStride
[],
int
srcSliceY
,
int
srcSliceH
,
uint8_t
*
dstParam
[],
int
dstStride
[])
{
uint8_t
*
dst1
=
dstParam
[
1
]
+
dstStride
[
1
]
*
srcSliceY
/
2
;
uint8_t
*
dst2
=
dstParam
[
2
]
+
dstStride
[
2
]
*
srcSliceY
/
2
;
copyPlane
(
src
[
0
],
srcStride
[
0
],
srcSliceY
,
srcSliceH
,
c
->
srcW
,
dstParam
[
0
],
dstStride
[
0
]);
if
(
c
->
srcFormat
==
AV_PIX_FMT_NV12
)
deinterleaveBytes
(
src
[
1
],
dst1
,
dst2
,
c
->
srcW
/
2
,
srcSliceH
/
2
,
srcStride
[
1
],
dstStride
[
1
],
dstStride
[
2
]);
else
deinterleaveBytes
(
src
[
1
],
dst2
,
dst1
,
c
->
srcW
/
2
,
srcSliceH
/
2
,
srcStride
[
1
],
dstStride
[
2
],
dstStride
[
1
]);
return
srcSliceH
;
}
static
int
planarToYuy2Wrapper
(
SwsContext
*
c
,
const
uint8_t
*
src
[],
static
int
planarToYuy2Wrapper
(
SwsContext
*
c
,
const
uint8_t
*
src
[],
int
srcStride
[],
int
srcSliceY
,
int
srcSliceH
,
int
srcStride
[],
int
srcSliceY
,
int
srcSliceH
,
uint8_t
*
dstParam
[],
int
dstStride
[])
uint8_t
*
dstParam
[],
int
dstStride
[])
...
@@ -1212,6 +1233,11 @@ void ff_get_unscaled_swscale(SwsContext *c)
...
@@ -1212,6 +1233,11 @@ void ff_get_unscaled_swscale(SwsContext *c)
(
dstFormat
==
AV_PIX_FMT_NV12
||
dstFormat
==
AV_PIX_FMT_NV21
))
{
(
dstFormat
==
AV_PIX_FMT_NV12
||
dstFormat
==
AV_PIX_FMT_NV21
))
{
c
->
swscale
=
planarToNv12Wrapper
;
c
->
swscale
=
planarToNv12Wrapper
;
}
}
/* nv12_to_yv12 */
if
(
dstFormat
==
AV_PIX_FMT_YUV420P
&&
(
srcFormat
==
AV_PIX_FMT_NV12
||
srcFormat
==
AV_PIX_FMT_NV21
))
{
c
->
swscale
=
nv12ToPlanarWrapper
;
}
/* yuv2bgr */
/* yuv2bgr */
if
((
srcFormat
==
AV_PIX_FMT_YUV420P
||
srcFormat
==
AV_PIX_FMT_YUV422P
||
if
((
srcFormat
==
AV_PIX_FMT_YUV420P
||
srcFormat
==
AV_PIX_FMT_YUV422P
||
srcFormat
==
AV_PIX_FMT_YUVA420P
)
&&
isAnyRGB
(
dstFormat
)
&&
srcFormat
==
AV_PIX_FMT_YUVA420P
)
&&
isAnyRGB
(
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