summaryrefslogtreecommitdiff
path: root/libswscale/yuv2rgb.c
diff options
context:
space:
mode:
authorFei Wang <fei.w.wang@intel.com>2020-04-22 13:23:02 +0800
committerLynne <dev@lynne.ee>2020-06-12 17:56:15 +0100
commitc721b450141d6bbe1e977212a0bcb70118965c34 (patch)
tree7b830e41fcbea1cd67686485a8c3faf5b78b8236 /libswscale/yuv2rgb.c
parentb09fb030c15fea2a1cbddf0074c498a415f3fed2 (diff)
swscale: Add swscale input/output support for X2RGB10LE
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Diffstat (limited to 'libswscale/yuv2rgb.c')
-rw-r--r--libswscale/yuv2rgb.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 588462504e..71d4b90baa 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -965,6 +965,28 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
fill_table(c->table_bU, 1, cbu, y_table + yoffs);
fill_gv_table(c->table_gV, 1, cgv);
break;
+ case 30:
+ rbase = 20;
+ gbase = 10;
+ bbase = 0;
+ needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
+ if (!needAlpha)
+ abase = 30;
+ ALLOC_YUV_TABLE(table_plane_size * 3 * 4);
+ y_table32 = c->yuvTable;
+ yb = -(384 << 16) - YUVRGB_TABLE_LUMA_HEADROOM*cy - oy;
+ for (i = 0; i < table_plane_size; i++) {
+ unsigned yval = av_clip_uint8((yb + 0x8000) >> 16);
+ y_table32[i]= (yval << rbase) + (needAlpha ? 0 : (255u << abase));
+ y_table32[i + table_plane_size] = yval << gbase;
+ y_table32[i + 2 * table_plane_size] = yval << bbase;
+ yb += cy;
+ }
+ fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
+ fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + table_plane_size);
+ fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2 * table_plane_size);
+ fill_gv_table(c->table_gV, 4, cgv);
+ break;
case 32:
case 64:
base = (c->dstFormat == AV_PIX_FMT_RGB32_1 ||