summaryrefslogtreecommitdiff
path: root/ext/x264/gstx264enc.c
diff options
context:
space:
mode:
authorSeungha Yang <seungha.yang@navercorp.com>2019-07-15 21:56:57 +0900
committerTim-Philipp Müller <tim@centricular.com>2019-07-15 17:06:23 +0000
commitf31f085e7bec95422f95056e2391fe1b7c26ee32 (patch)
treee4655371780805be6bb688be0cb8c4840eab6e34 /ext/x264/gstx264enc.c
parentfe92e92c14fa38d81a4a239536eedf547dd011d2 (diff)
x264enc: Port to color_{primaries,transfer,matrix}_to_iso
... with more color value mapping
Diffstat (limited to 'ext/x264/gstx264enc.c')
-rw-r--r--ext/x264/gstx264enc.c82
1 files changed, 6 insertions, 76 deletions
diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c
index 54bd7a1c..ed7262f8 100644
--- a/ext/x264/gstx264enc.c
+++ b/ext/x264/gstx264enc.c
@@ -1624,84 +1624,14 @@ gst_x264_enc_init_encoder (GstX264Enc * encoder)
if (!encoder->insert_vui)
goto skip_vui_parameters;
- switch (info->colorimetry.primaries) {
- case GST_VIDEO_COLOR_PRIMARIES_BT709:
- encoder->x264param.vui.i_colorprim = 1;
- break;
- case GST_VIDEO_COLOR_PRIMARIES_BT470M:
- encoder->x264param.vui.i_colorprim = 4;
- break;
- case GST_VIDEO_COLOR_PRIMARIES_BT470BG:
- encoder->x264param.vui.i_colorprim = 5;
- break;
- case GST_VIDEO_COLOR_PRIMARIES_SMPTE170M:
- encoder->x264param.vui.i_colorprim = 6;
- break;
- case GST_VIDEO_COLOR_PRIMARIES_SMPTE240M:
- encoder->x264param.vui.i_colorprim = 7;
- break;
- case GST_VIDEO_COLOR_PRIMARIES_FILM:
- encoder->x264param.vui.i_colorprim = 8;
- break;
- case GST_VIDEO_COLOR_PRIMARIES_BT2020:
- encoder->x264param.vui.i_colorprim = 9;
- break;
- default:
- encoder->x264param.vui.i_colorprim = 2;
- break;
- }
-
- switch (info->colorimetry.transfer) {
- case GST_VIDEO_TRANSFER_BT709:
- encoder->x264param.vui.i_transfer = 1;
- break;
- case GST_VIDEO_TRANSFER_GAMMA22:
- encoder->x264param.vui.i_transfer = 4;
- break;
- case GST_VIDEO_TRANSFER_GAMMA28:
- encoder->x264param.vui.i_transfer = 5;
- break;
- case GST_VIDEO_TRANSFER_SMPTE240M:
- encoder->x264param.vui.i_transfer = 7;
- break;
- case GST_VIDEO_TRANSFER_GAMMA10:
- encoder->x264param.vui.i_transfer = 8;
- break;
- case GST_VIDEO_TRANSFER_LOG100:
- encoder->x264param.vui.i_transfer = 9;
- break;
- case GST_VIDEO_TRANSFER_LOG316:
- encoder->x264param.vui.i_transfer = 10;
- break;
- default:
- encoder->x264param.vui.i_transfer = 2;
- break;
+ encoder->x264param.vui.i_colorprim =
+ gst_video_color_primaries_to_iso (info->colorimetry.primaries);
- }
+ encoder->x264param.vui.i_transfer =
+ gst_video_color_transfer_to_iso (info->colorimetry.transfer);
- switch (info->colorimetry.matrix) {
- case GST_VIDEO_COLOR_MATRIX_RGB:
- encoder->x264param.vui.i_colmatrix = 0;
- break;
- case GST_VIDEO_COLOR_MATRIX_FCC:
- encoder->x264param.vui.i_colmatrix = 4;
- break;
- case GST_VIDEO_COLOR_MATRIX_BT709:
- encoder->x264param.vui.i_colmatrix = 1;
- break;
- case GST_VIDEO_COLOR_MATRIX_BT601:
- encoder->x264param.vui.i_colmatrix = 5;
- break;
- case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
- encoder->x264param.vui.i_colmatrix = 7;
- break;
- case GST_VIDEO_COLOR_MATRIX_BT2020:
- encoder->x264param.vui.i_colmatrix = 9;
- break;
- default:
- encoder->x264param.vui.i_colmatrix = 2;
- break;
- }
+ encoder->x264param.vui.i_colmatrix =
+ gst_video_color_matrix_to_iso (info->colorimetry.matrix);
if (info->colorimetry.range == GST_VIDEO_COLOR_RANGE_0_255) {
encoder->x264param.vui.b_fullrange = 1;