mirror of https://github.com/HandBrake/HandBrake
hwaccel: add HB_HWACCEL_CAP_COLOR_RANGE flag
This commit is contained in:
parent
7cc0276fbd
commit
6543d50f3b
|
|
@ -245,6 +245,7 @@ struct hb_encoder_s
|
|||
#define HB_HWACCEL_CAP_SCAN 0x01
|
||||
#define HB_HWACCEL_CAP_ROTATE 0x02
|
||||
#define HB_HWACCEL_CAP_FORMAT_REQUIRED 0x04
|
||||
#define HB_HWACCEL_CAP_COLOR_RANGE 0x08
|
||||
|
||||
|
||||
struct hb_hwaccel_s
|
||||
|
|
|
|||
|
|
@ -36,6 +36,6 @@ AVBufferRef *hb_hwaccel_init_hw_frames_ctx(AVBufferRef *hw_device_ctx,
|
|||
|
||||
int hb_hwaccel_is_available(hb_hwaccel_t *hwaccel, int codec_id);
|
||||
int hb_hwaccel_can_use_full_hw_pipeline(hb_hwaccel_t *hwaccel, hb_list_t *list_filter,
|
||||
int encoder, int rotation);
|
||||
int encoder, int rotation, int color_range);
|
||||
|
||||
#endif // HANDBRAKE_HWACCEL_COMMON_H
|
||||
|
|
|
|||
|
|
@ -157,11 +157,17 @@ static int is_rotation_supported(hb_hwaccel_t *hwaccel, int rotation)
|
|||
return rotation != HB_ROTATION_0 && (hwaccel->caps & HB_HWACCEL_CAP_ROTATE) == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
int hb_hwaccel_can_use_full_hw_pipeline(hb_hwaccel_t *hwaccel, hb_list_t *list_filter, int encoder, int rotation)
|
||||
static int is_color_range_supported(hb_hwaccel_t *hwaccel, int color_range)
|
||||
{
|
||||
return color_range != 0 && (hwaccel->caps & HB_HWACCEL_CAP_COLOR_RANGE) == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
int hb_hwaccel_can_use_full_hw_pipeline(hb_hwaccel_t *hwaccel, hb_list_t *list_filter, int encoder, int rotation, int color_range)
|
||||
{
|
||||
return hwaccel != NULL &&
|
||||
hwaccel->can_filter(list_filter) &&
|
||||
is_rotation_supported(hwaccel, rotation) &&
|
||||
is_color_range_supported(hwaccel, color_range) &&
|
||||
is_encoder_supported(hwaccel, encoder);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -304,5 +304,5 @@ hb_hwaccel_t hb_hwaccel_nvdec =
|
|||
.type = AV_HWDEVICE_TYPE_CUDA,
|
||||
.hw_pix_fmt = AV_PIX_FMT_CUDA,
|
||||
.can_filter = hb_nvenc_are_filters_supported,
|
||||
.caps = HB_HWACCEL_CAP_SCAN
|
||||
.caps = HB_HWACCEL_CAP_SCAN | HB_HWACCEL_CAP_COLOR_RANGE
|
||||
};
|
||||
|
|
|
|||
|
|
@ -539,5 +539,5 @@ hb_hwaccel_t hb_hwaccel_videotoolbox =
|
|||
.hw_pix_fmt = AV_PIX_FMT_VIDEOTOOLBOX,
|
||||
.can_filter = are_filters_supported,
|
||||
.upload = copy_video_buffer_to_hw_video_buffer,
|
||||
.caps = HB_HWACCEL_CAP_SCAN | HB_HWACCEL_CAP_ROTATE
|
||||
.caps = HB_HWACCEL_CAP_SCAN | HB_HWACCEL_CAP_ROTATE | HB_HWACCEL_CAP_COLOR_RANGE
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3897,7 +3897,7 @@ hb_hwaccel_t hb_hwaccel_qsv =
|
|||
.hw_pix_fmt = AV_PIX_FMT_QSV,
|
||||
.can_filter = are_filters_supported,
|
||||
.find_decoder = find_decoder,
|
||||
.caps = HB_HWACCEL_CAP_ROTATE
|
||||
.caps = HB_HWACCEL_CAP_ROTATE | HB_HWACCEL_CAP_COLOR_RANGE
|
||||
};
|
||||
|
||||
#else // HB_PROJECT_FEATURE_QSV
|
||||
|
|
|
|||
|
|
@ -1743,7 +1743,8 @@ static void do_job(hb_job_t *job)
|
|||
if (hb_hwaccel_can_use_full_hw_pipeline(hwaccel,
|
||||
job->list_filter,
|
||||
job->vcodec,
|
||||
job->title->rotation))
|
||||
job->title->rotation,
|
||||
job->color_range != job->title->color_range))
|
||||
{
|
||||
job->hw_accel = hwaccel;
|
||||
job->hw_pix_fmt = hwaccel->hw_pix_fmt;
|
||||
|
|
|
|||
Loading…
Reference in New Issue