diff options
author | Damiano Galassi <[email protected]> | 2021-01-23 18:56:36 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2021-01-23 19:00:27 +0100 |
commit | ca260f666f0663997f72786a03a50f01ec7dc09f (patch) | |
tree | 44b4b1458903d77772a0b468108e1580ce433b90 /libhb | |
parent | 581f60136ad0c68b8849cd0b6f9331cf1283cb5c (diff) |
libhb: re-implement colorspace filter with zimg, add tonemap, and expose the colorspace filter in the cli
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/colorspace.c | 237 | ||||
-rw-r--r-- | libhb/common.c | 128 | ||||
-rw-r--r-- | libhb/decavcodec.c | 8 | ||||
-rw-r--r-- | libhb/handbrake/preset_builtin.h | 168 | ||||
-rw-r--r-- | libhb/param.c | 17 | ||||
-rw-r--r-- | libhb/preset.c | 30 | ||||
-rw-r--r-- | libhb/work.c | 3 |
7 files changed, 446 insertions, 145 deletions
diff --git a/libhb/colorspace.c b/libhb/colorspace.c index 2e94fc045..01b7dd9ee 100644 --- a/libhb/colorspace.c +++ b/libhb/colorspace.c @@ -14,8 +14,8 @@ static int colorspace_init(hb_filter_object_t * filter, hb_filter_init_t * init); const char colorspace_template[] = - "format=^"HB_ALL_REG"$:range=^"HB_ALL_REG"$:primaries=^"HB_ALL_REG"$:" - "matrix=^"HB_ALL_REG"$:transfer=^"HB_ALL_REG"$"; + "primaries=^"HB_ALL_REG"$:transfer=^"HB_ALL_REG"$:matrix=^"HB_ALL_REG"$:range=^"HB_ALL_REG"$:" + "tonemap=^"HB_ALL_REG"$:param=^"HB_FLOAT_REG"$:desat=^"HB_FLOAT_REG"$"; hb_filter_object_t hb_filter_colorspace = { @@ -30,6 +30,119 @@ hb_filter_object_t hb_filter_colorspace = .settings_template = colorspace_template, }; +static const char * get_matrix_name(int colorspace) +{ + switch (colorspace) { + case AVCOL_SPC_RGB: + return "gbr"; + case AVCOL_SPC_BT709: + return "bt709"; + case AVCOL_SPC_UNSPECIFIED: + return "unknown"; + case AVCOL_SPC_FCC: + return "fcc"; + case AVCOL_SPC_BT470BG: + return "bt470bg"; + case AVCOL_SPC_SMPTE170M: + return "smpte170m"; + case AVCOL_SPC_SMPTE240M: + return "smpte2400m"; + case AVCOL_SPC_YCGCO: + return "ycgco"; + case AVCOL_SPC_BT2020_NCL: + return "bt2020nc"; + case AVCOL_SPC_BT2020_CL: + return "bt2020c"; + case AVCOL_SPC_CHROMA_DERIVED_NCL: + return "chroma-derived-nc"; + case AVCOL_SPC_CHROMA_DERIVED_CL: + return "chroma-derived-c"; + case AVCOL_SPC_ICTCP: + return "ictcp"; + } + return "unspecified"; +} + +static const char * get_transfer_name(int color_trc) +{ + switch (color_trc) { + case AVCOL_TRC_UNSPECIFIED: + return "unspecified"; + case AVCOL_TRC_BT709: + return "709"; + case AVCOL_TRC_GAMMA22: + return "bt470m"; + case AVCOL_TRC_GAMMA28: + return "bt470bg"; + case AVCOL_TRC_SMPTE170M: + return "smpte170m"; + case AVCOL_TRC_SMPTE240M: + return "240m"; // fixme + case AVCOL_TRC_LINEAR: + return "linear"; + case AVCOL_TRC_LOG: + return "log100"; + case AVCOL_TRC_LOG_SQRT: + return "log316"; + case AVCOL_TRC_IEC61966_2_4: + return "iec61966-2-4"; + case AVCOL_TRC_BT2020_10: + return "2020_10"; + case AVCOL_TRC_BT2020_12: + return "2020_12"; + case AVCOL_TRC_SMPTE2084: + return "smpte2084"; + case AVCOL_TRC_ARIB_STD_B67: + return "arib-std-b67"; + case AVCOL_TRC_IEC61966_2_1: + return "iec61966-2-1"; + } + return "unspecified"; +} + +static const char * get_primaries_name(int color_primaries) +{ + switch (color_primaries) { + case AVCOL_PRI_UNSPECIFIED: + return "unspecified"; + case AVCOL_PRI_BT709: + return "709"; + case AVCOL_PRI_BT470M: + return "bt470m"; + case AVCOL_PRI_BT470BG: + return "bt470bg"; + case AVCOL_PRI_SMPTE170M: + return "smpte170m"; + case AVCOL_PRI_SMPTE240M: + return "smpte240m"; + case AVCOL_PRI_FILM: + return "film"; + case AVCOL_PRI_BT2020: + return "bt2020"; + case AVCOL_PRI_SMPTE428: + return "smpte428"; + case AVCOL_PRI_SMPTE431: + return "smpte431"; + case AVCOL_PRI_SMPTE432: + return "smpte432"; + case AVCOL_PRI_JEDEC_P22: + return "jedec-p22"; + } + return "unspecified"; +} + +static const char * get_range_name(int color_range) +{ + switch (color_range) { + case AVCOL_RANGE_UNSPECIFIED: + case AVCOL_RANGE_MPEG: + return "limited"; + case AVCOL_RANGE_JPEG: + return "full"; + } + return "limited"; +} + static int colorspace_init(hb_filter_object_t * filter, hb_filter_init_t * init) { hb_filter_private_t * pv = NULL; @@ -44,45 +157,139 @@ static int colorspace_init(hb_filter_object_t * filter, hb_filter_init_t * init) hb_dict_t * settings = filter->settings; - char * format = NULL, * range = NULL; + char * range = NULL; char * primaries = NULL, * transfer = NULL, * matrix = NULL; + char * tonemap = NULL; + double param = 0, desat = 0; - hb_dict_extract_string(&format, settings, "format"); hb_dict_extract_string(&range, settings, "range"); hb_dict_extract_string(&primaries, settings, "primaries"); hb_dict_extract_string(&transfer, settings, "transfer"); hb_dict_extract_string(&matrix, settings, "matrix"); + hb_dict_extract_string(&tonemap, settings, "tonemap"); + hb_dict_extract_double(¶m, settings, "param"); + hb_dict_extract_double(&desat, settings, "desat"); - if (!(format || range || primaries || transfer || matrix)) + if (!(range || primaries || transfer || matrix)) { return 0; } - hb_dict_t * avfilter = hb_dict_init(); - hb_dict_t * avsettings = hb_dict_init(); + int color_prim, color_transfer, color_matrix, color_range; - if (format) + color_prim = init->color_prim; + color_transfer = init->color_transfer; + color_matrix = init->color_matrix; + color_range = init->color_range; + + if (primaries) + { + color_prim = av_color_primaries_from_name(primaries); + } + if (transfer) { - hb_dict_set_string(avsettings, "format", format); + color_transfer = av_color_transfer_from_name(transfer); + } + if (matrix) + { + color_matrix = av_color_space_from_name(matrix); } if (range) { - hb_dict_set_string(avsettings, "range", range); + color_range = av_color_range_from_name(range); + } + + if (color_prim == init->color_prim && color_transfer == init->color_transfer && + color_matrix == init->color_matrix && color_range == init->color_range) + { + return 0; + } + + if (tonemap == NULL) + { + tonemap = "hable"; } + + hb_value_array_t * avfilters = hb_value_array_init(); + hb_dict_t * avfilter = NULL; + hb_dict_t * avsettings = NULL; + + if (transfer && init->color_transfer != color_transfer && + (init->color_transfer == HB_COLR_TRA_SMPTEST2084 || init->color_transfer == HB_COLR_TRA_ARIB_STD_B67)) + { + // Zscale + avfilter = hb_dict_init(); + avsettings = hb_dict_init(); + + hb_dict_set_string(avsettings, "transfer", "linear"); + hb_dict_set_string(avsettings, "npl", "100"); + hb_dict_set(avfilter, "zscale", avsettings); + + hb_value_array_append(avfilters, avfilter); + + // Format + avfilter = hb_dict_init(); + avsettings = hb_dict_init(); + + hb_dict_set_string(avsettings, "pix_fmts", "gbrpf32le"); + hb_dict_set(avfilter, "format", avsettings); + + hb_value_array_append(avfilters, avfilter); + + // Tonemap + avfilter = hb_dict_init(); + avsettings = hb_dict_init(); + + hb_dict_set_string(avsettings, "tonemap", tonemap); + if (strcmp(tonemap, "hable") && strcmp(tonemap, "none") && param != 0) + { + hb_dict_set_double(avsettings, "param", param); + } + hb_dict_set_double(avsettings, "desat", desat); + hb_dict_set(avfilter, "tonemap", avsettings); + + hb_value_array_append(avfilters, avfilter); + } + + // Zscale + avfilter = hb_dict_init(); + avsettings = hb_dict_init(); + if (primaries) { - hb_dict_set_string(avsettings, "primaries", primaries); + hb_dict_set_string(avsettings, "primaries", get_primaries_name(color_prim)); } if (transfer) { - hb_dict_set_string(avsettings, "trc", transfer); + hb_dict_set_string(avsettings, "transfer", get_transfer_name(color_transfer)); } if (matrix) { - hb_dict_set_string(avsettings, "space", matrix); + hb_dict_set_string(avsettings, "matrix", get_matrix_name(color_matrix)); + } + if (range) + { + hb_dict_set_string(avsettings, "range", get_range_name(color_range)); } - hb_dict_set(avfilter, "colorspace", avsettings); - pv->avfilters = avfilter; + + hb_dict_set(avfilter, "zscale", avsettings); + hb_value_array_append(avfilters, avfilter); + + // Format + avfilter = hb_dict_init(); + avsettings = hb_dict_init(); + + hb_dict_set_string(avsettings, "pix_fmts", av_get_pix_fmt_name(init->pix_fmt)); + hb_dict_set(avfilter, "format", avsettings); + + hb_value_array_append(avfilters, avfilter); + + pv->avfilters = avfilters; + + init->color_prim = color_prim; + init->color_transfer = color_transfer; + init->color_matrix = color_matrix; + init->color_range = color_range; pv->output = *init; diff --git a/libhb/common.c b/libhb/common.c index f61a99936..4c125430f 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -5855,134 +5855,6 @@ void hb_chapter_dequeue(hb_chapter_queue_t *q, hb_buffer_t *buf) } } -// Only return values supported by 'colorspace' avfilter: -const char * hb_get_format_name(int format) -{ - switch (format) - { - case AV_PIX_FMT_YUV420P: - return "yuv420p"; - case AV_PIX_FMT_YUV420P10: - return "yuv420p10"; - case AV_PIX_FMT_YUV420P12: - return "yuv420p12"; - case AV_PIX_FMT_YUV422P: - return "yuv422p"; - case AV_PIX_FMT_YUV422P10: - return "yuv422p10"; - case AV_PIX_FMT_YUV422P12: - return "yuv422p12"; - case AV_PIX_FMT_YUV444P: - return "yuv444p"; - case AV_PIX_FMT_YUV444P10: - return "yuv444p10"; - case AV_PIX_FMT_YUV444P12: - return "yuv444p12"; - default: - return NULL; - } -} - -// Only return values supported by 'colorspace' avfilter: -const char * hb_get_primaries_name(int primaries) -{ - switch (primaries) - { - case HB_COLR_PRI_BT709: - return "bt709"; - case HB_COLR_PRI_BT470M: - return "bt470m"; - case HB_COLR_PRI_EBUTECH: - return "bt470bg"; - case HB_COLR_PRI_SMPTEC: - return "smpte170m"; - case HB_COLR_PRI_SMPTE240M: - return "smpte240m"; - case HB_COLR_PRI_SMPTE428: - return "smpte428"; - case HB_COLR_PRI_FILM: - return "film"; - case HB_COLR_PRI_SMPTE431: - return "smpte431"; - case HB_COLR_PRI_SMPTE432: - return "smpte432"; - case HB_COLR_PRI_BT2020: - return "bt2020"; - case HB_COLR_PRI_JEDEC_P22: - return "jedec-p22"; - default: - return NULL; - } -} - -// Only return values supported by 'colorspace' avfilter: -const char * hb_get_transfer_name(int transfer) -{ - switch (transfer) - { - case HB_COLR_TRA_BT709: - return "bt709"; - case HB_COLR_TRA_GAMMA22: - return "gamma22"; - case HB_COLR_TRA_GAMMA28: - return "gamma28"; - case HB_COLR_TRA_SMPTE170M: - return "smpte170m"; - case HB_COLR_TRA_SMPTE240M: - return "smpte240m"; - case HB_COLR_TRA_IEC61966_2_1: - return "iec61966-2-1"; - case HB_COLR_TRA_IEC61966_2_4: - return "iec61966-2-4"; - case HB_COLR_TRA_BT2020_10: - return "bt2020-10"; - case HB_COLR_TRA_BT2020_12: - return "bt2020-12"; - default: - return NULL; - } -} - -// Only return values supported by 'colorspace' avfilter: -const char * hb_get_matrix_name(int matrix) -{ - switch (matrix) - { - case HB_COLR_MAT_BT709: - return "bt709"; - case HB_COLR_MAT_FCC: - return "fcc"; - case HB_COLR_MAT_BT470BG: - return "bt470bg"; - case HB_COLR_MAT_SMPTE170M: - return "smpte170m"; - case HB_COLR_MAT_SMPTE240M: - return "smpte240m"; - case HB_COLR_MAT_YCGCO: - return "ycgco"; - case HB_COLR_MAT_RGB: - return "gbr"; - case HB_COLR_MAT_BT2020_NCL: - return "bt2020ncl"; - default: - return NULL; - } -} - -// Only return values supported by 'colorspace' avfilter: -const char * hb_get_color_range_name(int range) -{ - switch (range) - { - case AVCOL_RANGE_MPEG: - return "mpeg"; - case AVCOL_RANGE_JPEG: - return "jpeg"; - default: - return "mpeg"; - } -} - int hb_get_bit_depth(int format) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format); diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index b59283252..1e4d94d38 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -962,6 +962,14 @@ static hb_buffer_t *copy_frame( hb_work_private_t *pv ) out = hb_avframe_to_video_buffer(pv->frame, (AVRational){1,1}); } + // Make sure every frame is tagged. + if (out->f.color_prim == HB_COLR_PRI_UNDEF || out->f.color_transfer == HB_COLR_TRA_UNDEF || out->f.color_matrix == HB_COLR_MAT_UNDEF) + { + out->f.color_prim = pv->title->color_prim; + out->f.color_transfer = pv->title->color_transfer; + out->f.color_matrix = pv->title->color_matrix; + } + if (pv->frame->pts != AV_NOPTS_VALUE) { reordered = reordered_hash_rem(pv, pv->frame->pts); diff --git a/libhb/handbrake/preset_builtin.h b/libhb/handbrake/preset_builtin.h index 77f635251..939adf3ae 100644 --- a/libhb/handbrake/preset_builtin.h +++ b/libhb/handbrake/preset_builtin.h @@ -41,6 +41,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"fast\", \n" " \"PictureDARWidth\": 0, \n" @@ -146,6 +148,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"fast\", \n" " \"PictureDARWidth\": 0, \n" @@ -251,6 +255,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"fast\", \n" " \"PictureDARWidth\": 0, \n" @@ -356,6 +362,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"fast\", \n" " \"PictureDARWidth\": 0, \n" @@ -461,6 +469,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -566,6 +576,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -671,6 +683,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -776,6 +790,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -895,6 +911,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1014,6 +1032,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1133,6 +1153,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1252,6 +1274,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1371,6 +1395,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1490,6 +1516,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1609,6 +1637,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1728,6 +1758,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1840,6 +1872,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -1945,6 +1979,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2050,6 +2086,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2155,6 +2193,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2260,6 +2300,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2365,6 +2407,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2470,6 +2514,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2575,6 +2621,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2680,6 +2728,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2785,6 +2835,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2890,6 +2942,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -2995,6 +3049,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3100,6 +3156,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3226,6 +3284,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3345,6 +3405,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3450,6 +3512,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3555,6 +3619,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3660,6 +3726,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3765,6 +3833,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3870,6 +3940,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -3989,6 +4061,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4108,6 +4182,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4227,6 +4303,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4346,6 +4424,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4465,6 +4545,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4584,6 +4666,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4703,6 +4787,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4822,6 +4908,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -4941,6 +5029,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5060,6 +5150,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5165,6 +5257,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5270,6 +5364,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5392,6 +5488,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5511,6 +5609,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5630,6 +5730,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5735,6 +5837,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5840,6 +5944,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -5959,6 +6065,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6071,6 +6179,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6176,6 +6286,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6281,6 +6393,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6386,6 +6500,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6491,6 +6607,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6596,6 +6714,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6701,6 +6821,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6806,6 +6928,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -6911,6 +7035,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7016,6 +7142,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7119,6 +7247,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7222,6 +7352,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7325,6 +7457,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7428,6 +7562,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7531,6 +7667,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7634,6 +7772,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7737,6 +7877,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7840,6 +7982,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -7943,6 +8087,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"default\", \n" " \"PictureDARWidth\": 0, \n" @@ -8054,6 +8200,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8158,6 +8306,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8262,6 +8412,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8366,6 +8518,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8478,6 +8632,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8583,6 +8739,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8688,6 +8846,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8793,6 +8953,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -8912,6 +9074,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -9033,6 +9197,8 @@ const char hb_builtin_presets_json[] = " \"PictureChromaSmoothCustom\": \"\", \n" " \"PictureChromaSmoothPreset\": \"off\", \n" " \"PictureChromaSmoothTune\": \"none\", \n" +" \"PictureColorspaceCustom\": \"\", \n" +" \"PictureColorspacePreset\": \"off\", \n" " \"PictureCombDetectCustom\": \"\", \n" " \"PictureCombDetectPreset\": \"off\", \n" " \"PictureDARWidth\": 0, \n" @@ -9101,7 +9267,7 @@ const char hb_builtin_presets_json[] = " \"x264Option\": \"\", \n" " \"x264UseAdvancedOptions\": false\n" " }, \n" -" \"VersionMajor\": 43, \n" +" \"VersionMajor\": 44, \n" " \"VersionMicro\": 0, \n" " \"VersionMinor\": 0\n" " }\n" diff --git a/libhb/param.c b/libhb/param.c index 987f6fcac..f9783ce19 100644 --- a/libhb/param.c +++ b/libhb/param.c @@ -94,6 +94,7 @@ static hb_filter_param_t hqdn3d_presets[] = static hb_filter_param_t chroma_smooth_presets[] = { + { 0, "Off", "off", NULL }, { 1, "Custom", "custom", NULL }, { 2, "Ultralight", "ultralight", NULL }, { 3, "Light", "light", NULL }, @@ -115,6 +116,17 @@ static hb_filter_param_t chroma_smooth_tunes[] = { 0, NULL, NULL, NULL } }; +static hb_filter_param_t colorspace_presets[] = +{ + { 0, "Off", "off", NULL }, + { 1, "Custom", "custom", NULL }, + { 2, "BT.2020", "bt2020", "primaries=bt2020:transfer=bt2020-10:matrix=bt2020ncl:tonemap=hable:desat=0" }, + { 3, "BT.709", "bt709", "primaries=bt709:transfer=bt709:matrix=bt709:tonemap=hable:desat=0" }, + { 4, "BT.601 SMPTE-C", "bt601-6-525", "primaries=smpte170m:transfer=bt709:matrix=smpte170m:tonemap=hable:desat=0" }, + { 5, "BT.601 EBU", "bt601-6-625", "primaries=bt470bg:transfer=bt709:matrix=smpte170m:tonemap=hable:desat=0" }, + { 0, NULL, NULL, NULL } +}; + static hb_filter_param_t unsharp_presets[] = { { 1, "Custom", "custom", NULL }, @@ -237,6 +249,9 @@ static filter_param_map_t param_map[] = sizeof(chroma_smooth_presets) / sizeof(hb_filter_param_t), sizeof(chroma_smooth_tunes) / sizeof(hb_filter_param_t), }, + { HB_FILTER_COLORSPACE, colorspace_presets, NULL, + sizeof(colorspace_presets) / sizeof(hb_filter_param_t), 0, }, + { HB_FILTER_UNSHARP, unsharp_presets, unsharp_tunes, sizeof(unsharp_presets) / sizeof(hb_filter_param_t), sizeof(unsharp_tunes) / sizeof(hb_filter_param_t), }, @@ -1239,7 +1254,6 @@ hb_generate_filter_settings(int filter_id, const char *preset, const char *tune, case HB_FILTER_RENDER_SUB: case HB_FILTER_GRAYSCALE: case HB_FILTER_QSV: - case HB_FILTER_COLORSPACE: settings = hb_parse_filter_settings(custom); break; case HB_FILTER_NLMEANS: @@ -1260,6 +1274,7 @@ hb_generate_filter_settings(int filter_id, const char *preset, const char *tune, case HB_FILTER_DETELECINE: case HB_FILTER_HQDN3D: case HB_FILTER_DEINTERLACE: + case HB_FILTER_COLORSPACE: settings = generate_generic_settings(filter_id, preset, tune, custom); break; diff --git a/libhb/preset.c b/libhb/preset.c index f7fdf2f2f..7c71bbb49 100644 --- a/libhb/preset.c +++ b/libhb/preset.c @@ -1585,6 +1585,36 @@ int hb_preset_apply_filters(const hb_dict_t *preset, hb_dict_t *job_dict) } free(pad); + // Colorspace filter + const char *colorspace = hb_value_get_string(hb_dict_get(preset, "PictureColorspacePreset")); + if (colorspace != NULL && + strcasecmp(colorspace, "off")) + { + const char * colorspace_custom = hb_value_get_string( + hb_dict_get(preset, "PictureColorspaceCustom")); + filter_settings = hb_generate_filter_settings(HB_FILTER_COLORSPACE, + colorspace, NULL, colorspace_custom); + if (filter_settings == NULL) + { + hb_error("Invalid colorspace filter settings (%s%s%s)", + colorspace, + colorspace_custom ? "," : "", + colorspace_custom ? colorspace_custom : ""); + return -1; + } + else if (!hb_dict_get_bool(filter_settings, "disable")) + { + filter_dict = hb_dict_init(); + hb_dict_set(filter_dict, "ID", hb_value_int(HB_FILTER_COLORSPACE)); + hb_dict_set(filter_dict, "Settings", filter_settings); + hb_add_filter2(filter_list, filter_dict); + } + else + { + hb_value_free(&filter_settings); + } + } + hb_value_t *fr_value = hb_dict_get(preset, "VideoFramerate"); int vrate_den = get_video_framerate(fr_value); if (vrate_den < 0) diff --git a/libhb/work.c b/libhb/work.c index 27fe2e7a0..28ccebcbf 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -1483,6 +1483,9 @@ static void do_job(hb_job_t *job) i++; } job->pix_fmt = init.pix_fmt; + job->color_prim = init.color_prim; + job->color_transfer = init.color_transfer; + job->color_matrix = init.color_matrix; job->width = init.geometry.width; job->height = init.geometry.height; job->par = init.geometry.par; |