@@ -47,22 +47,24 @@ __global__ static void VideoColorSpaceConversionKernel(
4747
4848    #pragma  unroll
4949    for  (int  i = 0 ; i < 2 ; i++) {
50-         float  cy = halfy + i * 0 .5f  + 0 .25f ;
50+         float  cy = halfy + i * 0 .5f  + 0 .5f ;
5151        #pragma  unroll
5252        for  (int  j = 0 ; j < 2 ; j++) {
53-             float  cx = halfx + j * 0 .5f  + 0 .25f ;
54-             u8vec3  yuv_val;
53+             float  cx = halfx + j * 0 .5f  + 0 .5f ;
54+             vec3  yuv_val;
5555            yuv_val[0 ] = Y.at (ivec2{x + j, y + i}, 0 , kernels::BorderClamp ());
5656
5757            UV (&yuv_val[1 ], vec2 (cx, cy), kernels::BorderClamp ());
5858
59-             u8vec3 out_val;
59+             yuv_val *= 1 .0f  / 255 .0f ;
60+ 
61+             vec3 out_val;
6062            switch  (conversion_type) {
6163              case  VIDEO_COLOR_SPACE_CONVERSION_TYPE_YUV_TO_RGB_FULL_RANGE:
62-                 out_val = dali::kernels::color::jpeg::ycbcr_to_rgb<uint8_t >(yuv_val);
64+                 out_val = dali::kernels::color::jpeg::ycbcr_to_rgb<float >(yuv_val);
6365                break ;
6466              case  VIDEO_COLOR_SPACE_CONVERSION_TYPE_YUV_TO_RGB:
65-                 out_val = dali::kernels::color::itu_r_bt_601::ycbcr_to_rgb<uint8_t >(yuv_val);
67+                 out_val = dali::kernels::color::itu_r_bt_601::ycbcr_to_rgb<float >(yuv_val);
6668                break ;
6769              case  VIDEO_COLOR_SPACE_CONVERSION_TYPE_YUV_UPSAMPLE:
6870                out_val = yuv_val;
@@ -71,10 +73,11 @@ __global__ static void VideoColorSpaceConversionKernel(
7173                assert (false );
7274            }
7375            if  (normalized_range) {
74-               output ({x + j, y + i, 0 }) = ConvertNorm <Out>(out_val.x );
75-               output ({x + j, y + i, 1 }) = ConvertNorm <Out>(out_val.y );
76-               output ({x + j, y + i, 2 }) = ConvertNorm <Out>(out_val.z );
76+               output ({x + j, y + i, 0 }) = ConvertSatNorm <Out>(out_val.x );
77+               output ({x + j, y + i, 1 }) = ConvertSatNorm <Out>(out_val.y );
78+               output ({x + j, y + i, 2 }) = ConvertSatNorm <Out>(out_val.z );
7779            } else  {
80+               out_val *= 255 .0f ;
7881              output ({x + j, y + i, 0 }) = ConvertSat<Out>(out_val.x );
7982              output ({x + j, y + i, 1 }) = ConvertSat<Out>(out_val.y );
8083              output ({x + j, y + i, 2 }) = ConvertSat<Out>(out_val.z );
0 commit comments