Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DALI_EXTRA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1ffbeaf1d085bb00f124038503508b3cb68e1a05
21dd6148f0cf4557531d54b810379c681c898e91
17 changes: 10 additions & 7 deletions dali/operators/video/color_space.cu
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,20 @@ __global__ static void VideoColorSpaceConversionKernel(
#pragma unroll
for (int j = 0; j < 2; j++) {
float cx = halfx + j * 0.5f + 0.25f;
u8vec3 yuv_val;
vec3 yuv_val;
yuv_val[0] = Y.at(ivec2{x + j, y + i}, 0, kernels::BorderClamp());

UV(&yuv_val[1], vec2(cx, cy), kernels::BorderClamp());

u8vec3 out_val;
yuv_val *= 1.0f / 255.0f;

vec3 out_val;
switch (conversion_type) {
case VIDEO_COLOR_SPACE_CONVERSION_TYPE_YUV_TO_RGB_FULL_RANGE:
out_val = dali::kernels::color::jpeg::ycbcr_to_rgb<uint8_t>(yuv_val);
out_val = dali::kernels::color::jpeg::ycbcr_to_rgb<float>(yuv_val);
break;
case VIDEO_COLOR_SPACE_CONVERSION_TYPE_YUV_TO_RGB:
out_val = dali::kernels::color::itu_r_bt_601::ycbcr_to_rgb<uint8_t>(yuv_val);
out_val = dali::kernels::color::itu_r_bt_601::ycbcr_to_rgb<float>(yuv_val);
break;
case VIDEO_COLOR_SPACE_CONVERSION_TYPE_YUV_UPSAMPLE:
out_val = yuv_val;
Expand All @@ -71,10 +73,11 @@ __global__ static void VideoColorSpaceConversionKernel(
assert(false);
}
if (normalized_range) {
output({x + j, y + i, 0}) = ConvertNorm<Out>(out_val.x);
output({x + j, y + i, 1}) = ConvertNorm<Out>(out_val.y);
output({x + j, y + i, 2}) = ConvertNorm<Out>(out_val.z);
output({x + j, y + i, 0}) = ConvertSatNorm<Out>(out_val.x);
output({x + j, y + i, 1}) = ConvertSatNorm<Out>(out_val.y);
output({x + j, y + i, 2}) = ConvertSatNorm<Out>(out_val.z);
} else {
out_val *= 255.0f;
output({x + j, y + i, 0}) = ConvertSat<Out>(out_val.x);
output({x + j, y + i, 1}) = ConvertSat<Out>(out_val.y);
output({x + j, y + i, 2}) = ConvertSat<Out>(out_val.z);
Expand Down
2 changes: 1 addition & 1 deletion dali/operators/video/frames_decoder_cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void FramesDecoderCpu::CopyToOutput(uint8_t *data) {
Width(),
Height(),
sws_output_format,
SWS_BILINEAR,
SWS_BILINEAR|SWS_FULL_CHR_H_INT|SWS_ACCURATE_RND,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused inaccurate results.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any performance implications of this change? How inaccurate were the results?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't asses this as this is not a performance tradeoff, but something that brings the accuracy to the right level.

nullptr,
nullptr,
nullptr),
Expand Down
245 changes: 0 additions & 245 deletions dali/operators/video/legacy/reader/nvdecoder/imgproc.cu

This file was deleted.

33 changes: 0 additions & 33 deletions dali/operators/video/legacy/reader/nvdecoder/imgproc.h

This file was deleted.

Loading
Loading