diff options
-rw-r--r-- | libhb/common.c | 27 | ||||
-rw-r--r-- | libhb/decavcodec.c | 8 | ||||
-rw-r--r-- | libhb/enc_qsv.c | 12 | ||||
-rw-r--r-- | libhb/encavcodec.c | 12 | ||||
-rw-r--r-- | libhb/encx264.c | 12 | ||||
-rw-r--r-- | libhb/encx265.c | 12 | ||||
-rw-r--r-- | libhb/handbrake/common.h | 4 | ||||
-rw-r--r-- | libhb/hb_json.c | 20 | ||||
-rw-r--r-- | libhb/preset.c | 8 | ||||
-rw-r--r-- | libhb/work.c | 6 | ||||
-rw-r--r-- | test/test.c | 2 |
11 files changed, 36 insertions, 87 deletions
diff --git a/libhb/common.c b/libhb/common.c index cda3683ee..a270f03e0 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -3841,9 +3841,6 @@ static void job_setup(hb_job_t * job, hb_title_t * title) job->color_transfer = title->color_transfer; job->color_matrix = title->color_matrix; job->color_range = title->color_range; - job->color_prim_override = HB_COLR_PRI_UNDEF; - job->color_transfer_override = HB_COLR_TRA_UNDEF; - job->color_matrix_override = HB_COLR_MAT_UNDEF; job->mux = HB_MUX_MP4; @@ -3862,30 +3859,6 @@ static void job_setup(hb_job_t * job, hb_title_t * title) #endif } -int hb_output_color_prim(hb_job_t * job) -{ - if (job->color_prim_override != HB_COLR_PRI_UNDEF) - return job->color_prim_override; - else - return job->color_prim; -} - -int hb_output_color_transfer(hb_job_t * job) -{ - if (job->color_transfer_override != HB_COLR_TRA_UNDEF) - return job->color_transfer_override; - else - return job->color_transfer; -} - -int hb_output_color_matrix(hb_job_t * job) -{ - if (job->color_matrix_override != HB_COLR_MAT_UNDEF) - return job->color_matrix_override; - else - return job->color_matrix; -} - static void job_clean( hb_job_t * job ) { if (job) diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 1e4d94d38..b64fcb2b2 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -963,11 +963,11 @@ static hb_buffer_t *copy_frame( hb_work_private_t *pv ) } // 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) + if (pv->job) { - out->f.color_prim = pv->title->color_prim; - out->f.color_transfer = pv->title->color_transfer; - out->f.color_matrix = pv->title->color_matrix; + out->f.color_prim = pv->job->color_prim; + out->f.color_transfer = pv->job->color_transfer; + out->f.color_matrix = pv->job->color_matrix; } if (pv->frame->pts != AV_NOPTS_VALUE) diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c index be18d3048..3790d42d1 100644 --- a/libhb/enc_qsv.c +++ b/libhb/enc_qsv.c @@ -1058,9 +1058,9 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job) pv->param.videoParam->AsyncDepth = job->qsv.async_depth; // set and enable colorimetry (video signal information) - pv->param.videoSignalInfo.ColourPrimaries = hb_output_color_prim(job); - pv->param.videoSignalInfo.TransferCharacteristics = hb_output_color_transfer(job); - pv->param.videoSignalInfo.MatrixCoefficients = hb_output_color_matrix(job); + pv->param.videoSignalInfo.ColourPrimaries = job->color_prim; + pv->param.videoSignalInfo.TransferCharacteristics = job->color_transfer; + pv->param.videoSignalInfo.MatrixCoefficients = job->color_matrix; pv->param.videoSignalInfo.ColourDescriptionPresent = 1; // parse user-specified encoder options, if present @@ -1117,9 +1117,9 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job) // reload colorimetry in case values were set in encoder_options if (pv->param.videoSignalInfo.ColourDescriptionPresent) { - job->color_prim_override = pv->param.videoSignalInfo.ColourPrimaries; - job->color_transfer_override = pv->param.videoSignalInfo.TransferCharacteristics; - job->color_matrix_override = pv->param.videoSignalInfo.MatrixCoefficients; + job->color_prim = pv->param.videoSignalInfo.ColourPrimaries; + job->color_transfer = pv->param.videoSignalInfo.TransferCharacteristics; + job->color_matrix = pv->param.videoSignalInfo.MatrixCoefficients; } // sanitize values that may exceed the Media SDK variable size diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index e42198abb..6cc01136e 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -441,9 +441,9 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) job->par.num, job->par.den ); // set colorimetry - context->color_primaries = hb_output_color_prim(job); - context->color_trc = hb_output_color_transfer(job); - context->colorspace = hb_output_color_matrix(job); + context->color_primaries = job->color_prim; + context->color_trc = job->color_transfer; + context->colorspace = job->color_matrix; if (!job->inline_parameter_sets) { @@ -656,9 +656,9 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job ) * Reload colorimetry settings in case custom * values were set in the encoder_options string. */ - job->color_prim_override = context->color_primaries; - job->color_transfer_override = context->color_trc; - job->color_matrix_override = context->colorspace; + job->color_prim = context->color_primaries; + job->color_transfer = context->color_trc; + job->color_matrix = context->colorspace; if (job->pass_id == HB_PASS_ENCODE_1ST && context->stats_out != NULL) diff --git a/libhb/encx264.c b/libhb/encx264.c index 514774c7a..f4e382266 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -389,9 +389,9 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) /* set up the VUI color model & gamma to match what the COLR atom * set in muxmp4.c says. See libhb/muxmp4.c for notes. */ - param.vui.i_colorprim = hb_output_color_prim(job); - param.vui.i_transfer = hb_output_color_transfer(job); - param.vui.i_colmatrix = hb_output_color_matrix(job); + param.vui.i_colorprim = job->color_prim; + param.vui.i_transfer = job->color_transfer; + param.vui.i_colmatrix = job->color_matrix; /* place job->encoder_options in an hb_dict_t for convenience */ hb_dict_t * x264_opts = NULL; @@ -425,9 +425,9 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) /* Reload colorimetry settings in case custom values were set * in the encoder_options string */ - job->color_prim_override = param.vui.i_colorprim; - job->color_transfer_override = param.vui.i_transfer; - job->color_matrix_override = param.vui.i_colmatrix; + job->color_prim = param.vui.i_colorprim; + job->color_transfer = param.vui.i_transfer; + job->color_matrix = param.vui.i_colmatrix; /* For 25 fps sources, HandBrake's explicit keyints will match the x264 defaults: * min-keyint 25 (same as auto), keyint 250. */ diff --git a/libhb/encx265.c b/libhb/encx265.c index fe6ef34ca..e7f58be16 100644 --- a/libhb/encx265.c +++ b/libhb/encx265.c @@ -184,9 +184,9 @@ int encx265Init(hb_work_object_t *w, hb_job_t *job) * flags, if any, should be set in the x265_param struct). */ char colorprim[11], transfer[11], colormatrix[11]; - snprintf(colorprim, sizeof(colorprim), "%d", hb_output_color_prim(job)); - snprintf(transfer, sizeof(transfer), "%d", hb_output_color_transfer(job)); - snprintf(colormatrix, sizeof(colormatrix), "%d", hb_output_color_matrix(job)); + snprintf(colorprim, sizeof(colorprim), "%d", job->color_prim); + snprintf(transfer, sizeof(transfer), "%d", job->color_transfer); + snprintf(colormatrix, sizeof(colormatrix), "%d", job->color_matrix); if (param_parse(pv, param, "colorprim", colorprim) || param_parse(pv, param, "transfer", transfer) || @@ -222,9 +222,9 @@ int encx265Init(hb_work_object_t *w, hb_job_t *job) * Reload colorimetry settings in case custom * values were set in the encoder_options string. */ - job->color_prim_override = param->vui.colorPrimaries; - job->color_transfer_override = param->vui.transferCharacteristics; - job->color_matrix_override = param->vui.matrixCoeffs; + job->color_prim = param->vui.colorPrimaries; + job->color_transfer = param->vui.transferCharacteristics; + job->color_matrix = param->vui.matrixCoeffs; /* * Settings which can't be overridden in the encodeer_options string diff --git a/libhb/handbrake/common.h b/libhb/handbrake/common.h index 8a1faa37f..1c08f947c 100644 --- a/libhb/handbrake/common.h +++ b/libhb/handbrake/common.h @@ -572,10 +572,6 @@ struct hb_job_s int color_transfer; int color_matrix; int color_range; - - int color_prim_override; - int color_transfer_override; - int color_matrix_override; // see https://developer.apple.com/library/content/technotes/tn2162/_index.html // https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html#//apple_ref/doc/uid/TP40000939-CH205-125526 // libav pixfmt.h diff --git a/libhb/hb_json.c b/libhb/hb_json.c index 3a40205a6..829b7fb01 100644 --- a/libhb/hb_json.c +++ b/libhb/hb_json.c @@ -672,21 +672,6 @@ hb_dict_t* hb_job_to_dict( const hb_job_t * job ) hb_value_int(job->color_transfer)); hb_dict_set(video_dict, "ColorMatrix", hb_value_int(job->color_matrix)); - if (job->color_prim_override != HB_COLR_PRI_UNDEF) - { - hb_dict_set(video_dict, "ColorPrimariesOverride", - hb_value_int(job->color_prim_override)); - } - if (job->color_transfer_override != HB_COLR_TRA_UNDEF) - { - hb_dict_set(video_dict, "ColorTransferOverride", - hb_value_int(job->color_transfer_override)); - } - if (job->color_matrix_override != HB_COLR_MAT_UNDEF) - { - hb_dict_set(video_dict, "ColorMatrixOverride", - hb_value_int(job->color_matrix_override)); - } if (job->vquality > HB_INVALID_VIDEO_QUALITY) { @@ -1059,13 +1044,11 @@ hb_job_t* hb_dict_to_job( hb_handle_t * h, hb_dict_t *dict ) // TwoPass, Turbo, // ColorFormat, ColorRange, // ColorPrimaries, ColorTransfer, ColorMatrix, - // ColorPrimariesOverride, ColorTransferOverride, ColorMatrixOverride, // QSV {Decode, AsyncDepth}} "s:{s:o, s?F, s?i, s?s, s?s, s?s, s?s, s?s," " s?b, s?b," " s?i, s?i," " s?i, s?i, s?i," - " s?i, s?i, s?i," " s?{s?b, s?i}}," // Audio {CopyMask, FallbackEncoder, AudioList} "s?{s?o, s?o, s?o}," @@ -1113,9 +1096,6 @@ hb_job_t* hb_dict_to_job( hb_handle_t * h, hb_dict_t *dict ) "ColorPrimaries", unpack_i(&job->color_prim), "ColorTransfer", unpack_i(&job->color_transfer), "ColorMatrix", unpack_i(&job->color_matrix), - "ColorPrimariesOverride", unpack_i(&job->color_prim_override), - "ColorTransferOverride", unpack_i(&job->color_transfer_override), - "ColorMatrixOverride", unpack_i(&job->color_matrix_override), "QSV", "Decode", unpack_b(&job->qsv.decode), "AsyncDepth", unpack_i(&job->qsv.async_depth), diff --git a/libhb/preset.c b/libhb/preset.c index 7c71bbb49..7219161cd 100644 --- a/libhb/preset.c +++ b/libhb/preset.c @@ -1697,7 +1697,7 @@ int hb_preset_apply_video(const hb_dict_t *preset, hb_dict_t *job_dict) video_dict = hb_dict_get(job_dict, "Video"); hb_dict_set(video_dict, "Encoder", hb_value_string(encoder->short_name)); - color_matrix_code = hb_value_get_int(hb_dict_get(preset, "VideoColorMatrixCodeOveride")); + color_matrix_code = hb_value_get_int(hb_dict_get(preset, "VideoColorMatrixCodeOverride")); if (color_matrix_code != 0) { int color_prim, color_transfer, color_matrix; @@ -1731,11 +1731,11 @@ int hb_preset_apply_video(const hb_dict_t *preset, hb_dict_t *job_dict) break; } - hb_dict_set(video_dict, "ColorPrimariesOverride", + hb_dict_set(video_dict, "ColorPrimaries", hb_value_int(color_prim)); - hb_dict_set(video_dict, "ColorTransferOverride", + hb_dict_set(video_dict, "ColorTransfer", hb_value_int(color_transfer)); - hb_dict_set(video_dict, "ColorMatrixOverride", + hb_dict_set(video_dict, "ColorMatrix", hb_value_int(color_matrix)); } hb_dict_set(video_dict, "Encoder", hb_value_dup(vcodec_value)); diff --git a/libhb/work.c b/libhb/work.c index 28ccebcbf..ab068173f 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -1456,9 +1456,9 @@ static void do_job(hb_job_t *job) init.pix_fmt = get_best_pix_ftm(job); init.color_range = AVCOL_RANGE_MPEG; - init.color_prim = title->color_prim; - init.color_transfer = title->color_transfer; - init.color_matrix = title->color_matrix; + init.color_prim = job->color_prim; + init.color_transfer = job->color_transfer; + init.color_matrix = job->color_matrix; init.geometry.width = title->geometry.width; init.geometry.height = title->geometry.height; diff --git a/test/test.c b/test/test.c index 9bf8e90bf..fc3c35897 100644 --- a/test/test.c +++ b/test/test.c @@ -1667,7 +1667,7 @@ static void ShowHelp() " Dimensions will be made divisible by this number.\n" " (default: set by preset, typically 2)\n" " -M, --color-matrix <string>\n" -" Set the color space signaled by the output:\n" +" Set the color space signaled by the input:\n" " Overrides color signalling with no conversion.\n" " 2020\n" " 709\n" |