mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
swscale: add input/output support for X2BGR10LE
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
0760d9153c
commit
32329397e2
@ -245,7 +245,8 @@ rgb48funcs(bgr, BE, AV_PIX_FMT_BGR48BE)
|
||||
origin == AV_PIX_FMT_ARGB || \
|
||||
origin == AV_PIX_FMT_ABGR) \
|
||||
? AV_RN32A(&src[(i) * 4]) \
|
||||
: ((origin == AV_PIX_FMT_X2RGB10LE) \
|
||||
: ((origin == AV_PIX_FMT_X2RGB10LE || \
|
||||
origin == AV_PIX_FMT_X2BGR10LE) \
|
||||
? AV_RL32(&src[(i) * 4]) \
|
||||
: (isBE(origin) ? AV_RB16(&src[(i) * 2]) \
|
||||
: AV_RL16(&src[(i) * 2]))))
|
||||
@ -393,6 +394,7 @@ rgb16_32_wrapper(AV_PIX_FMT_RGB565BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0,
|
||||
rgb16_32_wrapper(AV_PIX_FMT_RGB555BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
|
||||
rgb16_32_wrapper(AV_PIX_FMT_RGB444BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
|
||||
rgb16_32_wrapper(AV_PIX_FMT_X2RGB10LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
|
||||
rgb16_32_wrapper(AV_PIX_FMT_X2BGR10LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6)
|
||||
|
||||
static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
|
||||
const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
|
||||
@ -1344,6 +1346,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
|
||||
case AV_PIX_FMT_X2RGB10LE:
|
||||
c->chrToYV12 = rgb30leToUV_half_c;
|
||||
break;
|
||||
case AV_PIX_FMT_X2BGR10LE:
|
||||
c->chrToYV12 = bgr30leToUV_half_c;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (srcFormat) {
|
||||
@ -1428,6 +1433,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
|
||||
case AV_PIX_FMT_X2RGB10LE:
|
||||
c->chrToYV12 = rgb30leToUV_c;
|
||||
break;
|
||||
case AV_PIX_FMT_X2BGR10LE:
|
||||
c->chrToYV12 = bgr30leToUV_c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1708,7 +1716,10 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
|
||||
c->lumToYV12 = y210le_Y_c;
|
||||
break;
|
||||
case AV_PIX_FMT_X2RGB10LE:
|
||||
c->lumToYV12 =rgb30leToY_c;
|
||||
c->lumToYV12 = rgb30leToY_c;
|
||||
break;
|
||||
case AV_PIX_FMT_X2BGR10LE:
|
||||
c->lumToYV12 = bgr30leToY_c;
|
||||
break;
|
||||
}
|
||||
if (c->needAlpha) {
|
||||
|
@ -1603,7 +1603,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
|
||||
|
||||
dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
|
||||
dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
|
||||
} else if (target == AV_PIX_FMT_X2RGB10) {
|
||||
} else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) {
|
||||
uint32_t *dest = (uint32_t *) _dest;
|
||||
const uint32_t *r = (const uint32_t *) _r;
|
||||
const uint32_t *g = (const uint32_t *) _g;
|
||||
@ -1848,6 +1848,7 @@ YUV2RGBWRAPPER(yuv2rgb,, 8, AV_PIX_FMT_RGB8, 0)
|
||||
YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0)
|
||||
YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0)
|
||||
YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0)
|
||||
YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0)
|
||||
|
||||
static av_always_inline void yuv2rgb_write_full(SwsContext *c,
|
||||
uint8_t *dest, int i, int Y, int A, int U, int V,
|
||||
@ -3000,6 +3001,12 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
|
||||
*yuv2packed2 = yuv2x2rgb10_2_c;
|
||||
*yuv2packedX = yuv2x2rgb10_X_c;
|
||||
break;
|
||||
case AV_PIX_FMT_X2BGR10LE:
|
||||
case AV_PIX_FMT_X2BGR10BE:
|
||||
*yuv2packed1 = yuv2x2bgr10_1_c;
|
||||
*yuv2packed2 = yuv2x2bgr10_2_c;
|
||||
*yuv2packedX = yuv2x2bgr10_X_c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (dstFormat) {
|
||||
|
@ -267,6 +267,7 @@ static const FormatEntry format_entries[] = {
|
||||
[AV_PIX_FMT_NV42] = { 1, 1 },
|
||||
[AV_PIX_FMT_Y210LE] = { 1, 0 },
|
||||
[AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
|
||||
[AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
|
||||
};
|
||||
|
||||
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
|
||||
|
@ -783,6 +783,8 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
c->dstFormat == AV_PIX_FMT_RGB555LE ||
|
||||
c->dstFormat == AV_PIX_FMT_RGB444BE ||
|
||||
c->dstFormat == AV_PIX_FMT_RGB444LE ||
|
||||
c->dstFormat == AV_PIX_FMT_X2RGB10BE ||
|
||||
c->dstFormat == AV_PIX_FMT_X2RGB10LE ||
|
||||
c->dstFormat == AV_PIX_FMT_RGB8 ||
|
||||
c->dstFormat == AV_PIX_FMT_RGB4 ||
|
||||
c->dstFormat == AV_PIX_FMT_RGB4_BYTE ||
|
||||
@ -793,7 +795,8 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
c->dstFormat == AV_PIX_FMT_NE(BGR565LE, BGR565BE) ||
|
||||
c->dstFormat == AV_PIX_FMT_NE(BGR555LE, BGR555BE) ||
|
||||
c->dstFormat == AV_PIX_FMT_NE(BGR444LE, BGR444BE) ||
|
||||
c->dstFormat == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE);
|
||||
c->dstFormat == AV_PIX_FMT_NE(X2RGB10LE, X2RGB10BE) ||
|
||||
c->dstFormat == AV_PIX_FMT_NE(X2BGR10LE, X2BGR10BE);
|
||||
const int bpp = c->dstFormatBpp;
|
||||
uint8_t *y_table;
|
||||
uint16_t *y_table16;
|
||||
@ -966,9 +969,9 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
|
||||
fill_gv_table(c->table_gV, 1, cgv);
|
||||
break;
|
||||
case 30:
|
||||
rbase = 20;
|
||||
rbase = isRgb ? 20 : 0;
|
||||
gbase = 10;
|
||||
bbase = 0;
|
||||
bbase = isRgb ? 0 : 20;
|
||||
needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
|
||||
if (!needAlpha)
|
||||
abase = 30;
|
||||
|
1
tests/ref/fate/filter-pixdesc-x2bgr10le
Normal file
1
tests/ref/fate/filter-pixdesc-x2bgr10le
Normal file
@ -0,0 +1 @@
|
||||
pixdesc-x2bgr10le e9d67bd3d8912529148916d78c18c93a
|
@ -80,6 +80,7 @@ rgba b6e1b441c365e03b5ffdf9b7b68d9a0c
|
||||
rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea
|
||||
rgba64le b91e1d77f799eb92241a2d2d28437b15
|
||||
uyvy422 3bcf3c80047592f2211fae3260b1b65d
|
||||
x2bgr10le 550c0d190cf695afa4eaacb644db6b75
|
||||
x2rgb10le c1e3ac21be04a16bb157b22784524520
|
||||
xyz12be a1ef56bf746d71f59669c28e48fc8450
|
||||
xyz12le 831ff03c1ba4ef19374686f16a064d8c
|
||||
|
@ -77,6 +77,7 @@ rgb8 9b364a8f112ad9459fec47a51cc03b30
|
||||
rgba 9488ac85abceaf99a9309eac5a87697e
|
||||
rgba64be 89910046972ab3c68e2a348302cc8ca9
|
||||
rgba64le fea8ebfc869b52adf353778f29eac7a7
|
||||
x2bgr10le 84de725b85662c362862820dc4a309aa
|
||||
x2rgb10le f4265aca7a67dbfa9354370098ca6f33
|
||||
xyz12be cb4571f9aaa7b59f999ef327276104b7
|
||||
xyz12le cd6aae8d26b18bdb4b9d068586276d91
|
||||
|
@ -80,6 +80,7 @@ rgba ee616262ca6d67b7ecfba4b36c602ce3
|
||||
rgba64be 23c8c0edaabe3eaec89ce69633fb0048
|
||||
rgba64le dfdba4de4a7cac9abf08852666c341d3
|
||||
uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
|
||||
x2bgr10le dbe21538d7cb1744914f6bd46ec09b55
|
||||
x2rgb10le a18bc4ae5274e0a8cca9137ecd50c677
|
||||
xyz12be d2fa69ec91d3ed862f2dac3f8e7a3437
|
||||
xyz12le 02bccd5e0b6824779a1f848b0ea3e3b5
|
||||
|
@ -71,6 +71,7 @@ rgba 1fdf872a087a32cd35b80cc7be399578
|
||||
rgba64be 5598f44514d122b9a57c5c92c20bbc61
|
||||
rgba64le b34e6e30621ae579519a2d91a96a0acf
|
||||
uyvy422 75de70e31c435dde878002d3f22b238a
|
||||
x2bgr10le 86474d84f26c5c51d6f75bf7e1de8da8
|
||||
x2rgb10le cdf6a9e8a8d081aa768c6ae2e6221676
|
||||
xyz12be 15f5cda71de5fef9cec5e75e3833b6bc
|
||||
xyz12le 7be6c8781f38c21a6b8f602f62ca31e6
|
||||
|
@ -77,6 +77,7 @@ rgb8 68a3a575badadd9e4f90226209f11699
|
||||
rgba 51961c723ea6707e0a410cd3f21f15d3
|
||||
rgba64be c910444019f4cfbf4d995227af55da8d
|
||||
rgba64le 0c810d8b3a6bca10321788e1cb145340
|
||||
x2bgr10le 827cc659f29378e00c5a7d2c0ada8f9a
|
||||
x2rgb10le d4a8189b65395a88d0a38a7053f3359f
|
||||
xyz12be 25f90259ff8a226befdaec3dfe82996e
|
||||
xyz12le 926c0791d59aaff61b2778e8ada3316d
|
||||
|
@ -79,6 +79,7 @@ rgba 625d8f4bd39c4bdbf61eb5e4713aecc9
|
||||
rgba64be db70d33aa6c06f3e0a1c77bd11284261
|
||||
rgba64le a8a2daae04374a27219bc1c890204007
|
||||
uyvy422 d6ee3ca43356d08c392382b24b22cda5
|
||||
x2bgr10le 135acaff8318cf9861bb0f7849a9e5e9
|
||||
x2rgb10le 517fb186f523dc7cdc5c5c6967cfbe94
|
||||
xyz12be 7c7d54c55f136cbbc50b18029f3be0b3
|
||||
xyz12le 090ba6b1170baf2b1358b43b971d33b0
|
||||
|
@ -80,6 +80,7 @@ rgba b6e1b441c365e03b5ffdf9b7b68d9a0c
|
||||
rgba64be ae2ae04b5efedca3505f47c4dd6ea6ea
|
||||
rgba64le b91e1d77f799eb92241a2d2d28437b15
|
||||
uyvy422 3bcf3c80047592f2211fae3260b1b65d
|
||||
x2bgr10le 550c0d190cf695afa4eaacb644db6b75
|
||||
x2rgb10le c1e3ac21be04a16bb157b22784524520
|
||||
xyz12be a1ef56bf746d71f59669c28e48fc8450
|
||||
xyz12le 831ff03c1ba4ef19374686f16a064d8c
|
||||
|
@ -28,6 +28,7 @@ nv42 1738ad3c31c6c16e17679f5b09ce4677
|
||||
rgb0 78d500c8361ab6423a4826a00268c908
|
||||
rgb24 17f9e2e0c609009acaf2175c42d4a2a5
|
||||
rgba b157c90191463d34fb3ce77b36c96386
|
||||
x2bgr10le d4aff89f5e15ccbb1812f319874ed444
|
||||
x2rgb10le a0c5925bd56b6f85f918c4e9fb93e90e
|
||||
xyz12le 85abf80b77a9236a76ba0b00fcbdea2d
|
||||
ya16le 940fafa240b9916de5f73cb20a552f24
|
||||
|
@ -80,6 +80,7 @@ rgba 85bb5d03cea1c6e8002ced3373904336
|
||||
rgba64be ee73e57923af984b31cc7795d13929da
|
||||
rgba64le 783d2779adfafe3548bdb671ec0de69e
|
||||
uyvy422 aeb4ba4f9f003ae21f6d18089198244f
|
||||
x2bgr10le d57b9a99033cc7b65ddd111578f2d385
|
||||
x2rgb10le d56bdb23fa6a8e12a0b4394987f89935
|
||||
xyz12be c7ba8345998c0141ddc079cdd29b1a40
|
||||
xyz12le 95f5d3a0de834cc495c9032a14987cde
|
||||
|
@ -76,6 +76,7 @@ rgb8 c90feb30c3c9391ef5f470209d7b7a15
|
||||
rgba 4d76a9542143752a4ac30f82f88f68f1
|
||||
rgba64be a60041217f4c0cd796d19d3940a12a41
|
||||
rgba64le ad47197774858858ae7b0c177dffa459
|
||||
x2bgr10le 4aa774b6d8f6d446a64f1f288e5c97eb
|
||||
x2rgb10le 09cb1d98fe17ad8a6d9d3bec97ddc845
|
||||
xyz12be 68e5cba640f6e4ef72dff950e88b5342
|
||||
xyz12le 8b6b6a6db4d7561e80db88ccaecce7a9
|
||||
|
@ -80,6 +80,7 @@ rgba c1a5908572737f2ae1e5d8218af65f4b
|
||||
rgba64be 17e6273323b5779b5f3f775f150c1011
|
||||
rgba64le 48f45b10503b7dd140329c3dd0d54c98
|
||||
uyvy422 3a237e8376264e0cfa78f8a3fdadec8a
|
||||
x2bgr10le 795b66a5fc83cd2cf300aae51c230f80
|
||||
x2rgb10le 262c502230cf3724f8e2cf4737f18a42
|
||||
xyz12be 810644e008deb231850d779aaa27cc7e
|
||||
xyz12le 829701db461b43533cf9241e0743bc61
|
||||
|
Loading…
Reference in New Issue
Block a user