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
5c057433
Commit
5c057433
authored
May 06, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libswscale: GBRAP input & output and GBRAP16 input support
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
8d953722
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
64 additions
and
6 deletions
+64
-6
utils.c
libavcodec/utils.c
+1
-0
input.c
libswscale/input.c
+17
-1
output.c
libswscale/output.c
+8
-1
swscale.c
libswscale/swscale.c
+3
-0
swscale_internal.h
libswscale/swscale_internal.h
+2
-1
swscale_unscaled.c
libswscale/swscale_unscaled.c
+21
-0
utils.c
libswscale/utils.c
+3
-3
filter-pixdesc
tests/ref/fate/filter-pixdesc
+1
-0
filter-pixfmts-copy
tests/ref/fate/filter-pixfmts-copy
+1
-0
filter-pixfmts-field
tests/ref/fate/filter-pixfmts-field
+1
-0
filter-pixfmts-hflip
tests/ref/fate/filter-pixfmts-hflip
+1
-0
filter-pixfmts-il
tests/ref/fate/filter-pixfmts-il
+1
-0
filter-pixfmts-null
tests/ref/fate/filter-pixfmts-null
+1
-0
filter-pixfmts-pad
tests/ref/fate/filter-pixfmts-pad
+1
-0
filter-pixfmts-scale
tests/ref/fate/filter-pixfmts-scale
+1
-0
filter-pixfmts-vflip
tests/ref/fate/filter-pixfmts-vflip
+1
-0
No files found.
libavcodec/utils.c
View file @
5c057433
...
...
@@ -203,6 +203,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
case
AV_PIX_FMT_YUV422P
:
case
AV_PIX_FMT_YUV440P
:
case
AV_PIX_FMT_YUV444P
:
case
AV_PIX_FMT_GBRAP
:
case
AV_PIX_FMT_GBRP
:
case
AV_PIX_FMT_GRAY8
:
case
AV_PIX_FMT_GRAY16BE
:
...
...
libswscale/input.c
View file @
5c057433
...
...
@@ -720,6 +720,14 @@ static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int
}
}
static
void
planar_rgb_to_a
(
uint8_t
*
_dst
,
const
uint8_t
*
src
[
4
],
int
width
,
int32_t
*
unused
)
{
uint16_t
*
dst
=
(
uint16_t
*
)
_dst
;
int
i
;
for
(
i
=
0
;
i
<
width
;
i
++
)
dst
[
i
]
=
src
[
3
][
i
]
<<
6
;
}
static
void
planar_rgb_to_uv
(
uint8_t
*
_dstU
,
uint8_t
*
_dstV
,
const
uint8_t
*
src
[
4
],
int
width
,
int32_t
*
rgb2yuv
)
{
uint16_t
*
dstU
=
(
uint16_t
*
)
_dstU
;
...
...
@@ -835,6 +843,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case
AV_PIX_FMT_GBRP14LE
:
c
->
readChrPlanar
=
planar_rgb14le_to_uv
;
break
;
case
AV_PIX_FMT_GBRAP16LE
:
case
AV_PIX_FMT_GBRP16LE
:
c
->
readChrPlanar
=
planar_rgb16le_to_uv
;
break
;
...
...
@@ -850,9 +859,11 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case
AV_PIX_FMT_GBRP14BE
:
c
->
readChrPlanar
=
planar_rgb14be_to_uv
;
break
;
case
AV_PIX_FMT_GBRAP16BE
:
case
AV_PIX_FMT_GBRP16BE
:
c
->
readChrPlanar
=
planar_rgb16be_to_uv
;
break
;
case
AV_PIX_FMT_GBRAP
:
case
AV_PIX_FMT_GBRP
:
c
->
readChrPlanar
=
planar_rgb_to_uv
;
break
;
...
...
@@ -955,7 +966,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case
AV_PIX_FMT_BGR555BE
:
c
->
chrToYV12
=
bgr15beToUV_half_c
;
break
;
case
AV_PIX_FMT_GBR24P
:
case
AV_PIX_FMT_GBRAP
:
case
AV_PIX_FMT_GBRP
:
c
->
chrToYV12
=
gbr24pToUV_half_c
;
break
;
case
AV_PIX_FMT_BGR444LE
:
...
...
@@ -1084,6 +1096,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case
AV_PIX_FMT_GBRP14LE
:
c
->
readLumPlanar
=
planar_rgb14le_to_y
;
break
;
case
AV_PIX_FMT_GBRAP16LE
:
case
AV_PIX_FMT_GBRP16LE
:
c
->
readLumPlanar
=
planar_rgb16le_to_y
;
break
;
...
...
@@ -1099,9 +1112,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case
AV_PIX_FMT_GBRP14BE
:
c
->
readLumPlanar
=
planar_rgb14be_to_y
;
break
;
case
AV_PIX_FMT_GBRAP16BE
:
case
AV_PIX_FMT_GBRP16BE
:
c
->
readLumPlanar
=
planar_rgb16be_to_y
;
break
;
case
AV_PIX_FMT_GBRAP
:
c
->
readAlpPlanar
=
planar_rgb_to_a
;
case
AV_PIX_FMT_GBRP
:
c
->
readLumPlanar
=
planar_rgb_to_y
;
break
;
...
...
libswscale/output.c
View file @
5c057433
...
...
@@ -1495,7 +1495,7 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter,
{
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
c
->
dstFormat
);
int
i
;
int
hasAlpha
=
0
;
int
hasAlpha
=
(
desc
->
flags
&
PIX_FMT_ALPHA
)
&&
alpSrc
;
uint16_t
**
dest16
=
(
uint16_t
**
)
dest
;
int
SH
=
22
+
7
-
desc
->
comp
[
0
].
depth_minus1
;
...
...
@@ -1547,10 +1547,14 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter,
dest16
[
0
][
i
]
=
G
>>
SH
;
dest16
[
1
][
i
]
=
B
>>
SH
;
dest16
[
2
][
i
]
=
R
>>
SH
;
if
(
hasAlpha
)
dest16
[
3
][
i
]
=
A
;
}
else
{
dest
[
0
][
i
]
=
G
>>
22
;
dest
[
1
][
i
]
=
B
>>
22
;
dest
[
2
][
i
]
=
R
>>
22
;
if
(
hasAlpha
)
dest
[
3
][
i
]
=
A
;
}
}
if
(
SH
!=
22
&&
(
!
isBE
(
c
->
dstFormat
))
!=
(
!
HAVE_BIGENDIAN
))
{
...
...
@@ -1558,6 +1562,8 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter,
dest16
[
0
][
i
]
=
av_bswap16
(
dest16
[
0
][
i
]);
dest16
[
1
][
i
]
=
av_bswap16
(
dest16
[
1
][
i
]);
dest16
[
2
][
i
]
=
av_bswap16
(
dest16
[
2
][
i
]);
if
(
hasAlpha
)
dest16
[
3
][
i
]
=
av_bswap16
(
dest16
[
3
][
i
]);
}
}
}
...
...
@@ -1722,6 +1728,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
case
AV_PIX_FMT_GBRP14LE
:
case
AV_PIX_FMT_GBRP16BE
:
case
AV_PIX_FMT_GBRP16LE
:
case
AV_PIX_FMT_GBRAP
:
*
yuv2anyX
=
yuv2gbrp_full_X_c
;
break
;
}
...
...
libswscale/swscale.c
View file @
5c057433
...
...
@@ -256,6 +256,9 @@ static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
}
else
if
(
c
->
readLumPlanar
&&
!
isAlpha
)
{
c
->
readLumPlanar
(
formatConvBuffer
,
src_in
,
srcW
,
c
->
input_rgb2yuv_table
);
src
=
formatConvBuffer
;
}
else
if
(
c
->
readAlpPlanar
&&
isAlpha
)
{
c
->
readAlpPlanar
(
formatConvBuffer
,
src_in
,
srcW
,
NULL
);
src
=
formatConvBuffer
;
}
if
(
!
c
->
hyscale_fast
)
{
...
...
libswscale/swscale_internal.h
View file @
5c057433
...
...
@@ -504,12 +504,13 @@ typedef struct SwsContext {
/**
* Functions to read planar input, such as planar RGB, and convert
* internally to Y/UV.
* internally to Y/UV
/A
.
*/
/** @{ */
void
(
*
readLumPlanar
)(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
width
,
int32_t
*
rgb2yuv
);
void
(
*
readChrPlanar
)(
uint8_t
*
dstU
,
uint8_t
*
dstV
,
const
uint8_t
*
src
[
4
],
int
width
,
int32_t
*
rgb2yuv
);
void
(
*
readAlpPlanar
)(
uint8_t
*
dst
,
const
uint8_t
*
src
[
4
],
int
width
,
int32_t
*
rgb2yuv
);
/** @} */
/**
...
...
libswscale/swscale_unscaled.c
View file @
5c057433
...
...
@@ -492,6 +492,22 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[],
return
srcSliceH
;
}
static
int
planarRgbToplanarRgbWrapper
(
SwsContext
*
c
,
const
uint8_t
*
src
[],
int
srcStride
[],
int
srcSliceY
,
int
srcSliceH
,
uint8_t
*
dst
[],
int
dstStride
[])
{
copyPlane
(
src
[
0
],
srcStride
[
0
],
srcSliceY
,
srcSliceH
,
c
->
srcW
,
dst
[
0
],
dstStride
[
0
]);
copyPlane
(
src
[
1
],
srcStride
[
1
],
srcSliceY
,
srcSliceH
,
c
->
srcW
,
dst
[
1
],
dstStride
[
1
]);
copyPlane
(
src
[
2
],
srcStride
[
2
],
srcSliceY
,
srcSliceH
,
c
->
srcW
,
dst
[
2
],
dstStride
[
2
]);
if
(
dst
[
3
])
fillPlane
(
dst
[
3
],
dstStride
[
3
],
c
->
srcW
,
srcSliceH
,
srcSliceY
,
255
);
return
srcSliceH
;
}
static
void
packedtogbr24p
(
const
uint8_t
*
src
,
int
srcStride
,
uint8_t
*
dst
[],
int
dstStride
[],
int
srcSliceH
,
int
alpha_first
,
int
inc_size
,
int
width
)
...
...
@@ -1039,6 +1055,10 @@ void ff_get_unscaled_swscale(SwsContext *c)
&&
(
!
needsDither
||
(
c
->
flags
&
(
SWS_FAST_BILINEAR
|
SWS_POINT
))))
c
->
swScale
=
rgbToRgbWrapper
;
if
((
srcFormat
==
AV_PIX_FMT_GBRP
&&
dstFormat
==
AV_PIX_FMT_GBRAP
)
||
(
srcFormat
==
AV_PIX_FMT_GBRAP
&&
dstFormat
==
AV_PIX_FMT_GBRP
))
c
->
swScale
=
planarRgbToplanarRgbWrapper
;
#define isByteRGB(f) ( \
f == AV_PIX_FMT_RGB32 || \
f == AV_PIX_FMT_RGB32_1 || \
...
...
@@ -1066,6 +1086,7 @@ void ff_get_unscaled_swscale(SwsContext *c)
IS_DIFFERENT_ENDIANESS
(
srcFormat
,
dstFormat
,
AV_PIX_FMT_GBRP12
)
||
IS_DIFFERENT_ENDIANESS
(
srcFormat
,
dstFormat
,
AV_PIX_FMT_GBRP14
)
||
IS_DIFFERENT_ENDIANESS
(
srcFormat
,
dstFormat
,
AV_PIX_FMT_GBRP16
)
||
IS_DIFFERENT_ENDIANESS
(
srcFormat
,
dstFormat
,
AV_PIX_FMT_GBRAP16
)
||
IS_DIFFERENT_ENDIANESS
(
srcFormat
,
dstFormat
,
AV_PIX_FMT_RGB444
)
||
IS_DIFFERENT_ENDIANESS
(
srcFormat
,
dstFormat
,
AV_PIX_FMT_RGB48
)
||
IS_DIFFERENT_ENDIANESS
(
srcFormat
,
dstFormat
,
AV_PIX_FMT_RGBA64
)
||
...
...
libswscale/utils.c
View file @
5c057433
...
...
@@ -200,9 +200,9 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
[
AV_PIX_FMT_GBRP16BE
]
=
{
1
,
0
},
[
AV_PIX_FMT_XYZ12BE
]
=
{
1
,
0
,
1
},
[
AV_PIX_FMT_XYZ12LE
]
=
{
1
,
0
,
1
},
[
AV_PIX_FMT_GBRAP
]
=
{
0
,
0
},
[
AV_PIX_FMT_GBRAP16LE
]
=
{
0
,
0
},
[
AV_PIX_FMT_GBRAP16BE
]
=
{
0
,
0
},
[
AV_PIX_FMT_GBRAP
]
=
{
1
,
1
},
[
AV_PIX_FMT_GBRAP16LE
]
=
{
1
,
0
},
[
AV_PIX_FMT_GBRAP16BE
]
=
{
1
,
0
},
};
int
sws_isSupportedInput
(
enum
AVPixelFormat
pix_fmt
)
...
...
tests/ref/fate/filter-pixdesc
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be 13a36d6502be88fc0c2aec05b8d2d501
bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
gbrap 412a2449fdfaeb5ebdf5e4196cc7391a
gbrp 89d6e4b116e3bd542fa09a19a977ad16
gbrp10be 5dc62e2d01fa7c19a57abe48246f2232
gbrp10le 0cac205a304b59811ce30fcad49b3527
...
...
tests/ref/fate/filter-pixfmts-copy
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be 13a36d6502be88fc0c2aec05b8d2d501
bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
gbrap 412a2449fdfaeb5ebdf5e4196cc7391a
gbrp 89d6e4b116e3bd542fa09a19a977ad16
gbrp10be 5dc62e2d01fa7c19a57abe48246f2232
gbrp10le 0cac205a304b59811ce30fcad49b3527
...
...
tests/ref/fate/filter-pixfmts-field
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be bf955b9a035af0e613cf1de249f55f9d
bgr565le 6dd85cd5e19266c53a54cbcf06d396a7
bgr8 9669f6974f0fc1c0afa1c7d4df093c0b
bgra f7cabae31dd7465dab2203f45db646f8
gbrap fdb15f25cd6db3d19a7df727e0f4de3a
gbrp 55eab469e3e02ccc5a358565d9b1eaa7
gbrp10be 38753e9ac21e13d76d1a83bd7272c026
gbrp10le a65ff11ee79ae698550218549288e6cc
...
...
tests/ref/fate/filter-pixfmts-hflip
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be 3b464a00c619410eac7bdea9c96faf60
bgr565le 4b4c708d4ad222f41734dce68e9d48b6
bgr8 ad1db7a17cdfab2ede6f22c2415a3fbf
bgra 85fa06ad9fd156c3179a647a2e741b60
gbrap 5fbf0a36ee9486161a862a4b2d6f8242
gbrp 95fde5b6a767cf8d2679a4a6d18fdbe7
gbrp10be 5ddc834dbf2198f6b1af36c66b185e2c
gbrp10le 04814cbb805b66e8e085c7db4a548deb
...
...
tests/ref/fate/filter-pixfmts-il
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be 5ff7a76d9f58800e38f21a84d88c7129
bgr565le 485b2b6f589a936d6fb12d0033809dca
bgr8 d7fae34b87a67556c273585d9140ff96
bgra 7b4abc57f0ee99a0226e9bfd5d25cf9e
gbrap 583131faa19f062f6523321da52066de
gbrp b85cfeb0e34559ffb4b2e4f1209a3712
gbrp10be 5487219fee31607d6b19aa0d302fb42f
gbrp10le 7975e53a9e03a8acfa877334ae5e9d1d
...
...
tests/ref/fate/filter-pixfmts-null
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be 13a36d6502be88fc0c2aec05b8d2d501
bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
gbrap 412a2449fdfaeb5ebdf5e4196cc7391a
gbrp 89d6e4b116e3bd542fa09a19a977ad16
gbrp10be 5dc62e2d01fa7c19a57abe48246f2232
gbrp10le 0cac205a304b59811ce30fcad49b3527
...
...
tests/ref/fate/filter-pixfmts-pad
View file @
5c057433
...
...
@@ -5,6 +5,7 @@ argb e5fbb7bb282a80897b8f730627f68876
bgr0 c55368036cccbb0af471d6bd82abe02a
bgr24 67f9fd70dc6d9896b7122976b33932b4
bgra c8dd017b5a3b55e8b9d0ac1cdcf327bd
gbrap 23e8ef832c4aef52c6183f429ac86b32
gbrp 74f83deee9866bbdce3f91fa2aeddaaa
gray b1abadae3718522aa57a7972da8cbe17
rgb0 b1977b45634c4db58a183a07feb2acff
...
...
tests/ref/fate/filter-pixfmts-scale
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be fca6f07daf23d9dd84381dd4c9afd959
bgr565le f524e9f16bdd68b247dbcb621e543fc0
bgr8 68a3a395043dc57335ad1f8e891229c5
bgra 3eaf5489b8aa13a3388aad3751b597bf
gbrap 76ddf2bedea40c8743f4117b786d4773
gbrp 7b83ae32c1f76bd634e50f4797a74e92
gbrp10be 77dae432c42fad019c286753b0e4b0a8
gbrp10le 7d3e7341423b1206e8a6a3a02b48b5d7
...
...
tests/ref/fate/filter-pixfmts-vflip
View file @
5c057433
...
...
@@ -15,6 +15,7 @@ bgr565be 7100c2ddfee42e7efafec1ccefecf7c6
bgr565le 9fab295d966386d4ef99d5b43066da47
bgr8 275ce12eeb05de67a6915f67cbb43ce5
bgra d29c35871248c476c366e678db580982
gbrap 29844a8e4334493fdd2d499bcb532535
gbrp 7852e9bbe52cfad9bab8081a5c7a5a31
gbrp10be f591c6c98396baf3242837827081f2f7
gbrp10le c5edb9bb566edbc8c478595ac6ab070f
...
...
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