[FFmpeg-devel] [PATCH 2/2] sws: GBRP9, GBRP10 GBRP12 GBRP14 output support
Michael Niedermayer
michaelni at gmx.at
Fri Jan 25 23:35:45 CET 2013
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libswscale/output.c | 30 +++++++++++++++++++++++++++---
libswscale/utils.c | 21 ++++++++++-----------
tests/ref/lavfi/field | 8 ++++++++
tests/ref/lavfi/pixfmts_copy | 8 ++++++++
tests/ref/lavfi/pixfmts_null | 8 ++++++++
tests/ref/lavfi/pixfmts_pixdesctest | 8 ++++++++
tests/ref/lavfi/pixfmts_scale | 8 ++++++++
tests/ref/lavfi/pixfmts_vflip | 8 ++++++++
8 files changed, 85 insertions(+), 14 deletions(-)
diff --git a/libswscale/output.c b/libswscale/output.c
index edf364c..096830f 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1380,8 +1380,11 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter,
const int16_t **alpSrc, uint8_t **dest,
int dstW, int y)
{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
int i;
int hasAlpha = 0;
+ uint16_t **dest16 = (uint16_t**)dest;
+ int SH = 22 + 7 - desc->comp[0].depth_minus1;
for (i = 0; i < dstW; i++) {
int j;
@@ -1421,9 +1424,22 @@ yuv2gbrp_full_X_c(SwsContext *c, const int16_t *lumFilter,
B = av_clip_uintp2(B, 30);
}
- dest[0][i] = G >> 22;
- dest[1][i] = B >> 22;
- dest[2][i] = R >> 22;
+ if (SH != 22) {
+ dest16[0][i] = G >> SH;
+ dest16[1][i] = B >> SH;
+ dest16[2][i] = R >> SH;
+ } else {
+ dest[0][i] = G >> 22;
+ dest[1][i] = B >> 22;
+ dest[2][i] = R >> 22;
+ }
+ }
+ if (SH != 22 && (!isBE(c->dstFormat)) != (!HAVE_BIGENDIAN)) {
+ for (i = 0; i < dstW; i++) {
+ dest16[0][i] = av_bswap16(dest16[0][i]);
+ dest16[1][i] = av_bswap16(dest16[1][i]);
+ dest16[2][i] = av_bswap16(dest16[2][i]);
+ }
}
}
@@ -1541,6 +1557,14 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
*yuv2packedX = yuv2rgb8_full_X_c;
break;
case AV_PIX_FMT_GBRP:
+ case AV_PIX_FMT_GBRP9BE:
+ case AV_PIX_FMT_GBRP9LE:
+ case AV_PIX_FMT_GBRP10BE:
+ case AV_PIX_FMT_GBRP10LE:
+ case AV_PIX_FMT_GBRP12BE:
+ case AV_PIX_FMT_GBRP12LE:
+ case AV_PIX_FMT_GBRP14BE:
+ case AV_PIX_FMT_GBRP14LE:
*yuv2anyX = yuv2gbrp_full_X_c;
break;
}
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 4a29d65..4bb1144 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -186,14 +186,14 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
[AV_PIX_FMT_YUV444P14BE] = { 1, 1 },
[AV_PIX_FMT_YUV444P14LE] = { 1, 1 },
[AV_PIX_FMT_GBRP] = { 1, 1 },
- [AV_PIX_FMT_GBRP9LE] = { 1, 0 },
- [AV_PIX_FMT_GBRP9BE] = { 1, 0 },
- [AV_PIX_FMT_GBRP10LE] = { 1, 0 },
- [AV_PIX_FMT_GBRP10BE] = { 1, 0 },
- [AV_PIX_FMT_GBRP12LE] = { 1, 0 },
- [AV_PIX_FMT_GBRP12BE] = { 1, 0 },
- [AV_PIX_FMT_GBRP14LE] = { 1, 0 },
- [AV_PIX_FMT_GBRP14BE] = { 1, 0 },
+ [AV_PIX_FMT_GBRP9LE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP9BE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP10LE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP10BE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP12LE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP12BE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP14LE] = { 1, 1 },
+ [AV_PIX_FMT_GBRP14BE] = { 1, 1 },
[AV_PIX_FMT_GBRP16LE] = { 1, 0 },
[AV_PIX_FMT_GBRP16BE] = { 1, 0 },
};
@@ -1019,8 +1019,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
c->flags = flags;
}
}
- if(dstFormat == AV_PIX_FMT_GBRP
- ) {
+ if (isPlanarRGB(dstFormat)) {
if (!(flags & SWS_FULL_CHR_H_INT)) {
av_log(c, AV_LOG_DEBUG,
"%s output is not supported with half chroma resolution, switching to full\n",
@@ -1034,7 +1033,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
* chroma interpolation */
if (flags & SWS_FULL_CHR_H_INT &&
isAnyRGB(dstFormat) &&
- dstFormat != AV_PIX_FMT_GBRP &&
+ !isPlanarRGB(dstFormat) &&
dstFormat != AV_PIX_FMT_RGBA &&
dstFormat != AV_PIX_FMT_ARGB &&
dstFormat != AV_PIX_FMT_BGRA &&
diff --git a/tests/ref/lavfi/field b/tests/ref/lavfi/field
index 4ac1417..68a4643 100644
--- a/tests/ref/lavfi/field
+++ b/tests/ref/lavfi/field
@@ -16,6 +16,14 @@ bgr565le 6dd85cd5e19266c53a54cbcf06d396a7
bgr8 9669f6974f0fc1c0afa1c7d4df093c0b
bgra f7cabae31dd7465dab2203f45db646f8
gbrp 55eab469e3e02ccc5a358565d9b1eaa7
+gbrp10be 38753e9ac21e13d76d1a83bd7272c026
+gbrp10le a65ff11ee79ae698550218549288e6cc
+gbrp12be 5f49bf3190b98221dab95056ab46bd96
+gbrp12le 3d1cd386205bc690407c81a007a79170
+gbrp14be 60e2efec11a36e7cb0db95e01603d9eb
+gbrp14le fdcdecdd2c8dc13561a3788ce0487c85
+gbrp9be 86380bf8eaeee32ec40d776f699394e5
+gbrp9le 1286d4558d9bc7c3d68261f4b43e3ba9
gray 66a09b53f7d3f79dcb6096f3ec3740c5
gray16be a447af6482b922c9997ac02e5d3535f1
gray16le c1dd0db327295898ff282d07f48c105d
diff --git a/tests/ref/lavfi/pixfmts_copy b/tests/ref/lavfi/pixfmts_copy
index bedb352..68ec828 100644
--- a/tests/ref/lavfi/pixfmts_copy
+++ b/tests/ref/lavfi/pixfmts_copy
@@ -16,6 +16,14 @@ bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
gbrp 89d6e4b116e3bd542fa09a19a977ad16
+gbrp10be 5dc62e2d01fa7c19a57abe48246f2232
+gbrp10le 0cac205a304b59811ce30fcad49b3527
+gbrp12be de1d2a6b1d189bce9b9a2cf322c31c24
+gbrp12le e3267ef00bb48778df21a386416d2e14
+gbrp14be 7979d158b30c0b45db97aba2228d15fc
+gbrp14le d32b6c73a820f9d03a779a996924893d
+gbrp9be 2478d1c27ae4ec94ec4b5e439128af0c
+gbrp9le 640240ca2663e48f0bacd8edb5242c7d
gray 1e5e2b8548843a6898eedd9c974c422c
gray16be 389f4e5a8ab413b3af32767b59ed7f9e
gray16le a1f912941247e45b394b9cf4f0e81130
diff --git a/tests/ref/lavfi/pixfmts_null b/tests/ref/lavfi/pixfmts_null
index bedb352..68ec828 100644
--- a/tests/ref/lavfi/pixfmts_null
+++ b/tests/ref/lavfi/pixfmts_null
@@ -16,6 +16,14 @@ bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
gbrp 89d6e4b116e3bd542fa09a19a977ad16
+gbrp10be 5dc62e2d01fa7c19a57abe48246f2232
+gbrp10le 0cac205a304b59811ce30fcad49b3527
+gbrp12be de1d2a6b1d189bce9b9a2cf322c31c24
+gbrp12le e3267ef00bb48778df21a386416d2e14
+gbrp14be 7979d158b30c0b45db97aba2228d15fc
+gbrp14le d32b6c73a820f9d03a779a996924893d
+gbrp9be 2478d1c27ae4ec94ec4b5e439128af0c
+gbrp9le 640240ca2663e48f0bacd8edb5242c7d
gray 1e5e2b8548843a6898eedd9c974c422c
gray16be 389f4e5a8ab413b3af32767b59ed7f9e
gray16le a1f912941247e45b394b9cf4f0e81130
diff --git a/tests/ref/lavfi/pixfmts_pixdesctest b/tests/ref/lavfi/pixfmts_pixdesctest
index 9d0ac4a..05d5e0f 100644
--- a/tests/ref/lavfi/pixfmts_pixdesctest
+++ b/tests/ref/lavfi/pixfmts_pixdesctest
@@ -16,6 +16,14 @@ bgr565le ed027571692aecd522aa65a90cc7e09b
bgr8 71ef789609c746c2e7e4be9dec29062c
bgra 0364b074268682ea46168742a8239f7d
gbrp 89d6e4b116e3bd542fa09a19a977ad16
+gbrp10be 5dc62e2d01fa7c19a57abe48246f2232
+gbrp10le 0cac205a304b59811ce30fcad49b3527
+gbrp12be de1d2a6b1d189bce9b9a2cf322c31c24
+gbrp12le e3267ef00bb48778df21a386416d2e14
+gbrp14be 7979d158b30c0b45db97aba2228d15fc
+gbrp14le d32b6c73a820f9d03a779a996924893d
+gbrp9be 2478d1c27ae4ec94ec4b5e439128af0c
+gbrp9le 640240ca2663e48f0bacd8edb5242c7d
gray 1e5e2b8548843a6898eedd9c974c422c
gray16be 389f4e5a8ab413b3af32767b59ed7f9e
gray16le a1f912941247e45b394b9cf4f0e81130
diff --git a/tests/ref/lavfi/pixfmts_scale b/tests/ref/lavfi/pixfmts_scale
index 237004a..531da98 100644
--- a/tests/ref/lavfi/pixfmts_scale
+++ b/tests/ref/lavfi/pixfmts_scale
@@ -16,6 +16,14 @@ bgr565le f524e9f16bdd68b247dbcb621e543fc0
bgr8 68a3a395043dc57335ad1f8e891229c5
bgra 3eaf5489b8aa13a3388aad3751b597bf
gbrp 7b83ae32c1f76bd634e50f4797a74e92
+gbrp10be 2bc8c21383a6adb44f15d06615154b2c
+gbrp10le e5f1fddd18dd44d6e6e1275674b5d7b6
+gbrp12be 56d0b664e9905a20c1d05c15a0b34c2c
+gbrp12le 26650d0e35bdb55b6c699576608df0b4
+gbrp14be 2b4f1928a5ef53d0a216b3b10fa11ca0
+gbrp14le 47100ec39fad45579de1dff56fe17117
+gbrp9be b6240144e63e16fab97b5c38bd8673f1
+gbrp9le dc0477bf95cf457255b98855a170f6c8
gray 045c35e6cc7d41460f2b96b3e254deab
gray16be 70064f9acdc5e3935ccda67e765bf2fb
gray16le 578241fb43029e5ae841a3c94d940dce
diff --git a/tests/ref/lavfi/pixfmts_vflip b/tests/ref/lavfi/pixfmts_vflip
index dcb8cee..7990c3e 100644
--- a/tests/ref/lavfi/pixfmts_vflip
+++ b/tests/ref/lavfi/pixfmts_vflip
@@ -16,6 +16,14 @@ bgr565le 9fab295d966386d4ef99d5b43066da47
bgr8 275ce12eeb05de67a6915f67cbb43ce5
bgra d29c35871248c476c366e678db580982
gbrp 7852e9bbe52cfad9bab8081a5c7a5a31
+gbrp10be f591c6c98396baf3242837827081f2f7
+gbrp10le c5edb9bb566edbc8c478595ac6ab070f
+gbrp12be c61c19ad1bcca18719dd071e2cb77287
+gbrp12le 334a6c802ae0e15d9e0950c27ce4a457
+gbrp14be e24459d3b4a1e9c56ec3658c525b7a32
+gbrp14le 99207ef7c7dcb1d1369dc3fe3b5dc261
+gbrp9be 1daea1677f8a62c5a1ef8959c5e0e4b0
+gbrp9le e3cca50b844e7dd326eadf6e38fab84b
gray a53528cdf80ed31c9897042a2ea16618
gray16be 9b23f3e79c54a6ccb62e0135a32e3045
gray16le 93cfa8fbb2a86ead275ce1817444e6d5
--
1.7.9.5
More information about the ffmpeg-devel
mailing list